|
| 1 | +name: Release |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +jobs: |
| 5 | + release: |
| 6 | + runs-on: ubuntu-latest |
| 7 | + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} |
| 8 | + steps: |
| 9 | + - uses: actions/checkout@v2 |
| 10 | + with: |
| 11 | + fetch-depth: 0 |
| 12 | + lfs: true |
| 13 | + - name: Fetch next version |
| 14 | + id: nextVersion |
| 15 | + uses: VisualPinball/[email protected] |
| 16 | + with: |
| 17 | + tagPrefix: 'v' |
| 18 | + - name: Bump |
| 19 | + if: ${{ steps.nextVersion.outputs.isBump == 'true' }} |
| 20 | + run: | |
| 21 | + npm version ${{ steps.nextVersion.outputs.nextVersion }} --no-git-tag-version |
| 22 | + - name: Commit |
| 23 | + id: commit |
| 24 | + if: ${{ steps.nextVersion.outputs.isBump == 'true' }} |
| 25 | + run: | |
| 26 | + git config user.name "github-actions" |
| 27 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 28 | + git add package.json |
| 29 | + git commit -m "release: ${{ steps.nextVersion.outputs.nextTag }}." |
| 30 | + git push |
| 31 | + commitish=$(git rev-parse HEAD) |
| 32 | + echo ::set-output name=commitish::${commitish} |
| 33 | + env: |
| 34 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + - name: Create Release |
| 36 | + uses: actions/create-release@v1 |
| 37 | + with: |
| 38 | + tag_name: ${{ steps.nextVersion.outputs.nextTag }} |
| 39 | + release_name: ${{ steps.nextVersion.outputs.nextTag }} |
| 40 | + prerelease: ${{ steps.nextVersion.outputs.isPrerelease }} |
| 41 | + commitish: ${{ steps.commit.outputs.commitish }} |
| 42 | + env: |
| 43 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + |
| 45 | + dispatch: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + needs: [ release ] |
| 48 | + if: github.repository == 'VisualPinball/VisualPinball.Unity.VisualScripting' && github.ref == 'refs/heads/master' && github.event_name == 'push' |
| 49 | + steps: |
| 50 | + - uses: peter-evans/repository-dispatch@v1 |
| 51 | + with: |
| 52 | + token: ${{ secrets.GH_PAT }} |
| 53 | + event-type: release-complete |
| 54 | + client-payload: '{"artifacts_run_id": "${{ github.run_id }}"}' |
0 commit comments