rename workflow file #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Release | |
| on: | |
| push: | |
| branches: [ "**" ] | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'Draft a release for this build' | |
| required: false | |
| type: choice | |
| options: ['', 'MAJOR', 'MINOR', 'MICRO'] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| container: devkitpro/devkita64:latest | |
| env: | |
| RELEASE_TYPE: ${{ inputs.release_type }} | |
| outputs: | |
| version_tag: ${{ steps.extract_version.outputs.tag_name }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| filter: blob:none | |
| - name: Extract version from Makefile | |
| id: extract_version | |
| if: ${{ inputs.release_type != '' }} | |
| run: | | |
| VERSION=$(make version) | |
| echo "tag_name=${VERSION#[^0-9]}" >> $GITHUB_OUTPUT | |
| - name: Build project | |
| run: | | |
| chown -R $(whoami):$(whoami) . | |
| make | |
| mkdir -p dist | |
| mv switch-time.nro dist | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-assets | |
| path: dist/ | |
| release: | |
| needs: build | |
| if: ${{ needs.build.outputs.version_tag != '' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-assets | |
| path: dist | |
| - name: Draft release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="${{ needs.build.outputs.version_tag }}" | |
| gh release create "$TAG" dist/* \ | |
| --target ${{ github.sha }} \ | |
| --title "Release $TAG" \ | |
| --generate-notes --draft |