Skip to content

[Minor] Adds asynchronous task execution on a single tread #7

[Minor] Adds asynchronous task execution on a single tread

[Minor] Adds asynchronous task execution on a single tread #7

Workflow file for this run

name: Release
on:
pull_request:
branches: [ "main" ]
types: [closed]
permissions:
contents: write
pull-requests: read
jobs:
create-release:
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout with GitHub
uses: actions/checkout@v3
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Get highest release version
id: get_version
run: |
# Sort tags by version and pick the highest; if no tags are found, use v0.0.0
version=$(git tag --list 'v*' | sort -V | tail -n 1 || echo "v0.0.0")
echo "TAG=$version" >> $GITHUB_ENV
echo "Highest version is $version"
- name: Determine version increment
id: determine_increment
run: |
# Extract the current major, minor, and patch numbers from the TAG
major=$(echo "$TAG" | cut -d '.' -f1 | sed 's/v//')
echo "Major: $major"
minor=$(echo "$TAG" | cut -d '.' -f2)
echo "Minor: $minor"
patch=$(echo "$TAG" | cut -d '.' -f3)
echo "Patch: $patch"
# Check PR title and increment the respective part
pr_title="${{ github.event.pull_request.title }}"
if [[ "$pr_title" == *"[Major]"* ]]; then
major=$((major + 1))
minor=0 # Reset minor and patch when incrementing major
patch=0
elif [[ "$pr_title" == *"[Minor]"* ]]; then
minor=$((minor + 1))
patch=0 # Reset patch when incrementing minor
elif [[ "$pr_title" == *"[Patch]"* ]]; then
patch=$((patch + 1))
else
echo "Defaulting to minor increment"
minor=$((minor + 1))
patch=0
fi
# Recompose the TAG with the new version
TAG="v$major.$minor.$patch"
# Output the new TAG to verify the increment
echo "Updated TAG: $TAG"
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Create Release
id: release-action
uses: ncipollo/release-action@v1
with:
tag: ${{ env.TAG }}
name: Release ${{ env.TAG }}
commit: ${{ github.sha }}
body: ${{ github.event.pull_request.body }}
- name: Output Release URL File
run: |
echo "${{ steps.release-action.outputs.upload_url }}" > release_url.txt
- name: Save Release URL File for publish
uses: actions/upload-artifact@v4
with:
name: release_url
path: release_url.txt
build:
name: Build packages
needs: create-release
runs-on: ubuntu-latest
steps:
- name: Checkout with GitHub
uses: actions/checkout@v4
- name: Install additional dependencies
run: ./install_dependencies.sh
- name: Build project
run: make no-run
- name: Archive build output
run: |
zip -r AnasOS.iso.zip AnasOS.iso
- name: Load Release URL File from release job
id: download_release_info
uses: actions/download-artifact@v4
with:
name: release_url
- name: Get Release File Name & Upload URL
id: get_release_info
shell: bash
run: |
value=`cat "${{steps.download_release_info.outputs.download-path}}/release_url.txt"`
echo ::set-output name=upload_url::$value
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: AnasOS.iso.zip
asset_name: AnasOS.iso.zip
asset_content_type: application/zip