test version #19
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: Build project | |
| run: | | |
| echo "check what shell i'm in--$0" | |
| echo $0 | |
| chown -R $(whoami):$(whoami) . | |
| make | |
| mkdir -p dist | |
| mv switch-time.nro dist | |
| - name: Extract version from Makefile | |
| id: extract_version | |
| if: ${{ inputs.release_type != '' }} | |
| run: | | |
| VERSION=$(make version) | |
| echo "the next release version is--${VERSION}" | |
| echo "cleaned is--${VERSION#[^0-9]}" | |
| echo "tag_name=${VERSION#[^0-9]}" >> $GITHUB_OUTPUT | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| 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-artifacts | |
| path: dist | |
| - name: Draft release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="${{ needs.build.outputs.version_tag }}" | |
| gh release create "$TAG" dist/* \ | |
| --repo ${{ github.repository }} \ | |
| --target ${{ github.sha }} \ | |
| --title "Release $TAG" \ | |
| --generate-notes --draft |