|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: [CI] |
| 6 | + types: [completed] |
| 7 | + |
| 8 | +jobs: |
| 9 | + check: |
| 10 | + runs-on: blacksmith-2vcpu-ubuntu-2204 |
| 11 | + if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.event.workflow_run.head_branch, 'v') }} |
| 12 | + outputs: |
| 13 | + status: ${{ steps.check.conclusion }} |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + fetch-tags: true |
| 19 | + persist-credentials: false |
| 20 | + - id: check |
| 21 | + name: Verify that the ref is a tag (and not just a branch starting with "v") |
| 22 | + run: git show-ref --verify refs/tags/${{ github.event.workflow_run.head_branch }} |
| 23 | + |
| 24 | + release: |
| 25 | + runs-on: blacksmith-2vcpu-ubuntu-2204 |
| 26 | + needs: check |
| 27 | + if: needs.check.outputs.status == 'success' |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + persist-credentials: false |
| 33 | + - uses: taiki-e/install-action@parse-changelog |
| 34 | + - name: Generate Changelog |
| 35 | + run: parse-changelog CHANGELOG.md > ${{ github.workspace }}-CHANGELOG.md |
| 36 | + - name: Download JAR |
| 37 | + uses: actions/download-artifact@v4 |
| 38 | + with: |
| 39 | + name: jsonoid-server.jar |
| 40 | + github-token: ${{ secrets.GH_PAT }} |
| 41 | + run-id: ${{ github.event.workflow_run.id }} |
| 42 | + - name: Make source archive |
| 43 | + run: git archive --format tar.gz --prefix=jsonoid-server-${{ github.event.workflow_run.head_branch }}/ HEAD > jsonoid-server-${{ github.event.workflow_run.head_branch }}.tar.gz |
| 44 | + - name: Release |
| 45 | + uses: softprops/action-gh-release@v2 |
| 46 | + with: |
| 47 | + body_path: ${{ github.workspace }}-CHANGELOG.md |
| 48 | + files: | |
| 49 | + jsonoid-server*.jar |
| 50 | + jsonoid-server-*.tar.gz |
| 51 | + fail_on_unmatched_files: true |
| 52 | + tag_name: ${{ github.event.workflow_run.head_branch }} |
0 commit comments