Skip to content

Commit 1d4c8c5

Browse files
committed
chore: verify distribution by dry-running during ci workflow
1 parent 9cadf31 commit 1d4c8c5

File tree

1 file changed

+66
-2
lines changed

1 file changed

+66
-2
lines changed

Diff for: .github/workflows/ci.yml

+66-2
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,69 @@ jobs:
107107
path: app/build/native/nativeCompile/spotless*
108108
retention-days: 7
109109
if-no-files-found: "error"
110-
# TODO add job to check if jrelease distribute would be working
111-
# eg using `JRELEASER_GITHUB_TOKEN=123 jreleaser -Djreleaser.project.version=0.1.0 publish --dry-run`
110+
111+
dryRunRelease:
112+
name: "dry run release"
113+
needs: "nativeCompile"
114+
strategy:
115+
matrix:
116+
platform:
117+
- name: "linux-x86_64"
118+
runner: "ubuntu-latest"
119+
- name: "windows-x86_64"
120+
runner: "windows-latest"
121+
runs-on: "${{ matrix.platform.runner }}"
122+
steps:
123+
- name: "Checkout"
124+
uses: "actions/checkout@v4"
125+
with:
126+
fetch-depth: 0
127+
- name: "Install JDK 21"
128+
uses: "actions/setup-java@v4"
129+
with:
130+
distribution: "graalvm"
131+
java-version: 21
132+
- name: "Setup Gradle"
133+
uses: "gradle/actions/setup-gradle@v4"
134+
- name: "Retrieve binaries"
135+
uses: "actions/download-artifact@v4"
136+
with:
137+
# no name - download all artifacts
138+
path: "app/build/collected-binaries"
139+
- name: "Prepare release zips for distribution"
140+
run: "./gradlew -PreleaseBinariesRootDir=app/build/collected-binaries prepareReleaseBinaryZips"
141+
- name: "Get version and set to output"
142+
id: get_version
143+
run: echo "VERSION=$(./gradlew changelogPrintCurrentVersion --quiet)" >> "$GITHUB_OUTPUT"
144+
- name: "Dry-run choco distribution"
145+
if: "${{ matrix.platform.name == 'windows-x86_64' }}"
146+
uses: jreleaser/release-action@v2
147+
with:
148+
setup-java: false
149+
arguments: "publish --dry-run"
150+
env:
151+
JRELEASER_PROJECT_VERSION: ${{ steps.get_version.outputs.VERSION }}
152+
JRELEASER_GITHUB_TOKEN: abc # don't provide correct token, just a dry-run
153+
JRELEASER_DISTRIBUTIONS_SPOTLESS_CLI_CHOCOLATEY_ACTIVE: ALWAYS
154+
JRELEASER_CHOCOLATEY_GITHUB_TOKEN: abc # don't provide correct token, just a dry-run
155+
JRELEASER_CHOCOLATEY_API_KEY: abc # don't provide correct token, just a dry-run
156+
- name: "Dry-run brew distribution"
157+
if: "${{ matrix.platform.name == 'linux-x86_64' }}"
158+
uses: jreleaser/release-action@v2
159+
with:
160+
setup-java: false
161+
arguments: "publish --dry-run"
162+
env:
163+
JRELEASER_PROJECT_VERSION: ${{ steps.get_version.outputs.VERSION }}
164+
JRELEASER_GITHUB_TOKEN: abc # don't provide correct token, just a dry-run
165+
JRELEASER_DISTRIBUTIONS_SPOTLESS_CLI_BREW_ACTIVE: ALWAYS
166+
JRELEASER_HOMEBREW_GITHUB_TOKEN: abc # don't provide correct token, just a dry-run
167+
- name: "Persist jreleaser output"
168+
if: always()
169+
uses: actions/upload-artifact@v4
170+
with:
171+
name: "jreleaser-distribution-dry-run--${{ matrix.platform.name }}"
172+
path: |
173+
out/jreleaser/trace.log
174+
out/jreleaser/output.properties
175+
out/jreleaser/package/spotless-cli/**

0 commit comments

Comments
 (0)