fix: release please clean-up and failure on premature publishing (#39) #40
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: Release Please | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| APP_NAME: WindowTool | |
| # Only one run per branch may execute at a time, and if a newer run starts we’ll | |
| # cancel the older one | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Release Please | |
| uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| token: ${{ secrets.RELEASE_PLEASE_TOKEN }} | |
| build: | |
| needs: release | |
| if: ${{ needs.release.outputs.release_created }} | |
| strategy: | |
| matrix: | |
| platform: [x64, x86] | |
| uses: ./.github/workflows/build.yml | |
| with: | |
| platform: ${{ matrix.platform }} | |
| configuration: Release | |
| secrets: inherit | |
| publish: | |
| name: Publish Release | |
| runs-on: ubuntu-latest | |
| needs: [release,build] | |
| if: ${{ needs.release.outputs.release_created }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.release.outputs.tag_name }} | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "*-artifact" | |
| merge-multiple: false | |
| - name: Zip Artifacts | |
| run: | | |
| mv x86-artifact x86 | |
| mv x64-artifact x64 | |
| zip -r "${{ env.APP_NAME }}-${{ needs.release.outputs.tag_name }}.zip" x86 x64 LICENSE | |
| - name: Upload Release Artifact | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh release upload ${{ needs.release.outputs.tag_name }} "${{ env.APP_NAME }}-${{ needs.release.outputs.tag_name }}.zip" | |