|
9 | 9 | jobs: |
10 | 10 | validation: |
11 | 11 | runs-on: ubuntu-20.04 |
| 12 | + outputs: |
| 13 | + commitid: ${{steps.commitid.outputs.short}} |
12 | 14 | steps: |
13 | 15 | - name: Setup Dynamic Env |
14 | 16 | run: | |
|
61 | 63 | with: |
62 | 64 | name: hook-${{steps.commitid.outputs.short}} |
63 | 65 | path: out/${{steps.commitid.outputs.short}}/rel/hook_*.tar.gz |
| 66 | + |
| 67 | + publish-release-latest: |
| 68 | + runs-on: ubuntu-20.04 |
| 69 | + if: github.ref == 'refs/heads/main' |
| 70 | + needs: validation |
| 71 | + steps: |
| 72 | + - name: Checkout code |
| 73 | + uses: actions/checkout@v3 |
| 74 | + |
| 75 | + - name: Download Artifact |
| 76 | + uses: actions/download-artifact@v3 |
| 77 | + with: |
| 78 | + name: hook-${{needs.validation.outputs.commitid}} |
| 79 | + |
| 80 | + - name: Delete Tag |
| 81 | + run: | |
| 82 | + git tag -d latest || echo "no local tag to delete" |
| 83 | + git push origin :latest -f || echo "no remote tag to delete" |
| 84 | +
|
| 85 | + - name: Generate Release Notes |
| 86 | + run: | |
| 87 | + generated_release_notes=$(gh api 'repos/{owner}/{repo}/releases/generate-notes' -F tag_name=latest --jq .body) |
| 88 | + cat >>"$GITHUB_ENV" <<-EOF |
| 89 | + RELEASE_NOTES<<RELEASE_NOTES_EOF |
| 90 | + # :warning: :rotating_light: :boom: Note!!! :boom: :rotating_light: :warning: |
| 91 | +
|
| 92 | + The uploaded files will be updated on the next merge to main, as such download them before use to avoid surprises. |
| 93 | +
|
| 94 | + --- |
| 95 | + Commit: ${{needs.validation.outputs.commitid}} |
| 96 | + --- |
| 97 | +
|
| 98 | + $generated_release_notes |
| 99 | + RELEASE_NOTES_EOF |
| 100 | + EOF |
| 101 | + env: |
| 102 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 103 | + |
| 104 | + - name: Update Tag |
| 105 | + uses: rickstaa/action-create-tag@v1 |
| 106 | + with: |
| 107 | + tag: latest |
| 108 | + message: "Latest development build" |
| 109 | + |
| 110 | + - name: Update latest release |
| 111 | + uses: softprops/action-gh-release@v1 |
| 112 | + with: |
| 113 | + name: Hook Latest Development Build |
| 114 | + body: ${{env.RELEASE_NOTES}} |
| 115 | + files: hook_*.tar.gz |
| 116 | + prerelease: true |
| 117 | + tag_name: latest |
| 118 | + |
| 119 | + publish-release-tag: |
| 120 | + runs-on: ubuntu-20.04 |
| 121 | + if: startsWith(github.ref, 'refs/tags/v') |
| 122 | + needs: validation |
| 123 | + steps: |
| 124 | + - name: Checkout code |
| 125 | + uses: actions/checkout@v3 |
| 126 | + |
| 127 | + - name: Download Artifact |
| 128 | + uses: actions/download-artifact@v3 |
| 129 | + with: |
| 130 | + name: hook-${{needs.validation.outputs.commitid}} |
| 131 | + |
| 132 | + - name: Generate Release Notes |
| 133 | + run: | |
| 134 | + generated_release_notes=$(gh api 'repos/{owner}/{repo}/releases/generate-notes' -F tag_name=${{github.ref}} --jq .body) |
| 135 | + cat >>"$GITHUB_ENV" <<-EOF |
| 136 | + RELEASE_NOTES<<RELEASE_NOTES_EOF |
| 137 | + $generated_release_notes |
| 138 | + RELEASE_NOTES_EOF |
| 139 | + EOF |
| 140 | + env: |
| 141 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 142 | + |
| 143 | + - name: Update latest release |
| 144 | + uses: softprops/action-gh-release@v1 |
| 145 | + with: |
| 146 | + body: ${{env.RELEASE_NOTES}} |
| 147 | + files: hook_*.tar.gz |
0 commit comments