Skip to content

Commit 82b4844

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

File tree

1 file changed

+68
-2
lines changed

1 file changed

+68
-2
lines changed

Diff for: .github/workflows/ci.yml

+68-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
gradleCheck:
2020
name: "run checks using gradlew"
2121
runs-on: "ubuntu-latest"
22+
outputs:
23+
RELEASE_VERSION: ${{ steps.get_version.outputs.VERSION }}
2224
env:
2325
SEGMENT_DOWNLOAD_TIMEOUT_MINS: "15"
2426
steps:
@@ -48,6 +50,9 @@ jobs:
4850
run: "./gradlew :build-logic:check --no-configuration-cache"
4951
- name: "Run check on project"
5052
run: "./gradlew generateUsage && ./gradlew check"
53+
- name: "Get version and set to output"
54+
id: get_version
55+
run: echo "VERSION=$(./gradlew changelogPrintCurrentVersion --quiet)" >> "$GITHUB_OUTPUT"
5156
- name: "junit result"
5257
uses: "mikepenz/action-junit-report@v5"
5358
if: "always()"
@@ -107,5 +112,66 @@ jobs:
107112
path: app/build/native/nativeCompile/spotless*
108113
retention-days: 7
109114
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`
115+
116+
dryRunRelease:
117+
name: "dry run release"
118+
needs: ["gradleCheck", "nativeCompile"]
119+
strategy:
120+
matrix:
121+
platform:
122+
- name: "linux-x86_64"
123+
runner: "ubuntu-latest"
124+
- name: "windows-x86_64"
125+
runner: "windows-latest"
126+
runs-on: "${{ matrix.platform.runner }}"
127+
steps:
128+
- name: "Checkout"
129+
uses: "actions/checkout@v4"
130+
with:
131+
fetch-depth: 0
132+
- name: "Install JDK 21"
133+
uses: "actions/setup-java@v4"
134+
with:
135+
distribution: "graalvm"
136+
java-version: 21
137+
- name: "Setup Gradle"
138+
uses: "gradle/actions/setup-gradle@v4"
139+
- name: "Retrieve binaries"
140+
uses: "actions/download-artifact@v4"
141+
with:
142+
# no name - download all artifacts
143+
path: "app/build/collected-binaries"
144+
- name: "Prepare release zips for distribution"
145+
run: "./gradlew -PreleaseBinariesRootDir=app/build/collected-binaries prepareReleaseBinaryZips"
146+
- name: "Dry-run choco distribution"
147+
if: "${{ matrix.platform.name == 'windows-x86_64' }}"
148+
uses: jreleaser/release-action@v2
149+
with:
150+
setup-java: false
151+
arguments: "publish --dry-run"
152+
env:
153+
JRELEASER_PROJECT_VERSION: ${{ jobs.gradleCheck.outputs.RELEASE_VERSION }}
154+
JRELEASER_GITHUB_TOKEN: abc # don't provide correct token, just a dry-run
155+
JRELEASER_DISTRIBUTIONS_SPOTLESS_CLI_CHOCOLATEY_ACTIVE: ALWAYS
156+
JRELEASER_CHOCOLATEY_GITHUB_TOKEN: abc # don't provide correct token, just a dry-run
157+
JRELEASER_CHOCOLATEY_API_KEY: abc # don't provide correct token, just a dry-run
158+
- name: "Dry-run brew distribution"
159+
if: "${{ matrix.platform.name == 'linux-x86_64' }}"
160+
uses: jreleaser/release-action@v2
161+
with:
162+
setup-java: false
163+
arguments: "publish --dry-run"
164+
env:
165+
JRELEASER_PROJECT_VERSION: ${{ jobs.gradleCheck.outputs.RELEASE_VERSION }}
166+
JRELEASER_GITHUB_TOKEN: abc # don't provide correct token, just a dry-run
167+
JRELEASER_DISTRIBUTIONS_SPOTLESS_CLI_BREW_ACTIVE: ALWAYS
168+
JRELEASER_HOMEBREW_GITHUB_TOKEN: abc # don't provide correct token, just a dry-run
169+
- name: "Persist jreleaser output"
170+
if: always()
171+
uses: actions/upload-artifact@v4
172+
with:
173+
name: "jreleaser-distribution-dry-run--${{ matrix.platform.name }}"
174+
path: |
175+
out/jreleaser/trace.log
176+
out/jreleaser/output.properties
177+
out/jreleaser/package/spotless-cli/**

0 commit comments

Comments
 (0)