Skip to content

Commit 07e44e8

Browse files
committed
build: Switch to JReleaser
1 parent 2f1670d commit 07e44e8

File tree

8 files changed

+287
-242
lines changed

8 files changed

+287
-242
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,6 @@ jobs:
1616

1717
- name: Set up Go
1818
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
25-
with:
26-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
27-
passphrase: ${{ secrets.GPG_PASSPHRASE }}
28-
29-
#- name: Set up Snapcraft
30-
# shell: bash
31-
# run: |
32-
# sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
3319

3420
- name: Get Dependencies
3521
shell: bash
@@ -45,20 +31,20 @@ jobs:
4531
token: ${{ secrets.CODECOV_TOKEN }}
4632
file: ./coverage.txt
4733

48-
- name: GoReleaser Snapshot
49-
uses: goreleaser/goreleaser-action@v5
34+
- name: Assemble
35+
uses: jreleaser/release-action@v2
5036
with:
51-
version: latest
52-
args: build --snapshot
37+
arguments: assemble
5338
env:
54-
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
55-
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
56-
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
57-
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
58-
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
59-
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
60-
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
61-
MASTODON_CLIENT_ID: ${{ secrets.MASTODON_CLIENT_ID }}
62-
MASTODON_CLIENT_SECRET: ${{ secrets.MASTODON_CLIENT_SECRET }}
63-
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
64-
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_LOGIN }}
39+
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }}
40+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: JReleaser assemble output
43+
if: always()
44+
uses: actions/upload-artifact@v4
45+
with:
46+
retention-days: 1
47+
name: jreleaser-build
48+
path: |
49+
out/jreleaser/trace.log
50+
out/jreleaser/output.properties

.github/workflows/early-access.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: EarlyAccess
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
precheck:
9+
if: github.repository == 'kordamp/gm' && startsWith(github.event.head_commit.message, 'Releasing version') != true
10+
runs-on: ubuntu-latest
11+
outputs:
12+
VERSION: ${{ steps.vars.outputs.VERSION }}
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Cancel previous run
18+
uses: styfle/[email protected]
19+
with:
20+
access_token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Version
23+
id: vars
24+
shell: bash
25+
run: |
26+
echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
27+
28+
release:
29+
needs: [ precheck ]
30+
if: endsWith(${{ needs.precheck.outputs.VERSION }}, '-SNAPSHOT')
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
39+
- name: Set up Go
40+
uses: actions/setup-go@v5
41+
42+
- name: Assemble
43+
uses: jreleaser/release-action@v2
44+
with:
45+
arguments: assemble
46+
env:
47+
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }}
48+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: JReleaser assemble output
51+
if: always()
52+
uses: actions/upload-artifact@v4
53+
with:
54+
retention-days: 1
55+
name: jreleaser-assemble
56+
path: |
57+
out/jreleaser/trace.log
58+
out/jreleaser/output.properties
59+
60+
- name: Release
61+
uses: jreleaser/release-action@v2
62+
with:
63+
arguments: release
64+
env:
65+
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }}
66+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: JReleaser release output
69+
if: always()
70+
uses: actions/upload-artifact@v4
71+
with:
72+
retention-days: 1
73+
name: jreleaser-release
74+
path: |
75+
out/jreleaser/trace.log
76+
out/jreleaser/output.properties

.github/workflows/release.yml

Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,78 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version'
8+
required: true
79

810
jobs:
9-
Release:
11+
release:
12+
name: Release
1013
runs-on: ubuntu-latest
1114
steps:
1215
- name: Checkout
1316
uses: actions/checkout@v4
1417
with:
1518
fetch-depth: 0
1619

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+
uses: styfle/[email protected]
2522
with:
26-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
27-
passphrase: ${{ secrets.GPG_PASSPHRASE }}
23+
access_token: ${{ secrets.GITHUB_TOKEN }}
2824

29-
- name: Set up Snapcraft
30-
shell: bash
25+
- name: Commit version
3126
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
3333
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
4241
env:
43-
CHOCOLATEY_VERSION: 1.4.0
42+
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
43+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4444

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
4854
49-
- name: Run GoReleaser
50-
uses: goreleaser/goreleaser-action@v5
55+
- name: Release
56+
uses: jreleaser/release-action@v2
5157
with:
52-
version: latest
53-
args: release --clean
58+
arguments: release
5459
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

Comments
 (0)