|
1 | 1 | name: Release |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - tags: |
6 | | - - 'v*' |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'Release version' |
| 8 | + required: true |
7 | 9 |
|
8 | 10 | jobs: |
9 | | - Release: |
| 11 | + release: |
| 12 | + name: Release |
10 | 13 | runs-on: ubuntu-latest |
11 | 14 | steps: |
12 | 15 | - name: Checkout |
13 | 16 | uses: actions/checkout@v4 |
14 | 17 | with: |
15 | 18 | fetch-depth: 0 |
16 | 19 |
|
17 | | - - name: Set up Go |
18 | | - uses: actions/setup-go@v5 |
19 | | - with: |
20 | | - go-version: '1.25.3' |
21 | | - |
22 | | - - name: Import GPG key |
23 | | - id: import_gpg |
24 | | - uses: crazy-max/ghaction-import-gpg@v5 |
| 20 | + - name: Cancel previous run |
| 21 | + |
25 | 22 | with: |
26 | | - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} |
27 | | - passphrase: ${{ secrets.GPG_PASSPHRASE }} |
| 23 | + access_token: ${{ secrets.GITHUB_TOKEN }} |
28 | 24 |
|
29 | | - - name: Set up Snapcraft |
30 | | - shell: bash |
| 25 | + - name: Commit version |
31 | 26 | run: | |
32 | | - sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft |
| 27 | + echo ${{ github.event.inputs.version }} > VERSION |
| 28 | + git add VERSION |
| 29 | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 30 | + git config --global user.name "GitHub Action" |
| 31 | + git commit -a -m "Releasing version ${{ needs.precheck.outputs.VERSION }}" |
| 32 | + git push origin main |
33 | 33 |
|
34 | | - - name: Setup Chocolatey |
35 | | - shell: bash |
36 | | - run: | |
37 | | - mkdir -p /opt/chocolatey |
38 | | - wget -q -O - "https://github.com/chocolatey/choco/releases/download/${CHOCOLATEY_VERSION}/chocolatey.v${CHOCOLATEY_VERSION}.tar.gz" | tar -xz -C "/opt/chocolatey" |
39 | | - echo '#!/bin/bash' >> /usr/local/bin/choco |
40 | | - echo 'mono /opt/chocolatey/choco.exe $@' >> /usr/local/bin/choco |
41 | | - chmod +x /usr/local/bin/choco |
| 34 | + - name: Setup Go |
| 35 | + uses: actions/setup-go@v5 |
| 36 | + |
| 37 | + - name: Assemble |
| 38 | + uses: jreleaser/release-action@v2 |
| 39 | + with: |
| 40 | + arguments: assemble |
42 | 41 | env: |
43 | | - CHOCOLATEY_VERSION: 1.4.0 |
| 42 | + JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }} |
| 43 | + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
44 | 44 |
|
45 | | - - name: Get Dependencies |
46 | | - shell: bash |
47 | | - run: go get ./... |
| 45 | + - name: JReleaser assemble output |
| 46 | + if: always() |
| 47 | + uses: actions/upload-artifact@v4 |
| 48 | + with: |
| 49 | + retention-days: 1 |
| 50 | + name: jreleaser-assemble |
| 51 | + path: | |
| 52 | + out/jreleaser/trace.log |
| 53 | + out/jreleaser/output.properties |
48 | 54 |
|
49 | | - - name: Run GoReleaser |
50 | | - uses: goreleaser/goreleaser-action@v5 |
| 55 | + - name: Release |
| 56 | + uses: jreleaser/release-action@v2 |
51 | 57 | with: |
52 | | - version: latest |
53 | | - args: release --clean |
| 58 | + arguments: release |
54 | 59 | env: |
55 | | - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
56 | | - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
57 | | - TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} |
58 | | - TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} |
59 | | - TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} |
60 | | - TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} |
61 | | - MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }} |
62 | | - MASTODON_CLIENT_ID: ${{ secrets.MASTODON_CLIENT_ID }} |
63 | | - MASTODON_CLIENT_SECRET: ${{ secrets.MASTODON_CLIENT_SECRET }} |
64 | | - CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }} |
65 | | - SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_LOGIN }} |
| 60 | + JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }} |
| 61 | + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
| 63 | + JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} |
| 64 | + JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} |
| 65 | + JRELEASER_BLUESKY_HOST: ${{ secrets.BLUESKY_HOST }} |
| 66 | + JRELEASER_BLUESKY_HANDLE: ${{ secrets.BLUESKY_HANDLE }} |
| 67 | + JRELEASER_BLUESKY_PASSWORD: ${{ secrets.BLUESKY_PASSWORD }} |
| 68 | + JRELEASER_MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }} |
| 69 | + |
| 70 | + - name: JReleaser release output |
| 71 | + if: always() |
| 72 | + uses: actions/upload-artifact@v4 |
| 73 | + with: |
| 74 | + retention-days: 1 |
| 75 | + name: jreleaser-release |
| 76 | + path: | |
| 77 | + out/jreleaser/trace.log |
| 78 | + out/jreleaser/output.properties |
0 commit comments