Skip to content

Commit ddcf03a

Browse files
authored
ci(snapshot): skip deploy if no snapshot version or release version (#238)
1 parent b3d7c6d commit ddcf03a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
- name: Checkout
4141
uses: actions/checkout@v4
4242
with:
43+
ref: ${{ inputs.ref }}
4344
fetch-depth: 0
4445
- name: Validate tag does not exist on current commit
4546
uses: ./.github/workflows/validate-tag
@@ -51,6 +52,12 @@ jobs:
5152
echo "Tag should match pom.xml project.version"
5253
exit 1
5354
fi
55+
- name: Validate version is a release version
56+
run: |
57+
if [[ "$(./mvnw -q help:evaluate -Dexpression=project.version -DforceStdout)" =~ "-SNAPSHOT" ]]; then
58+
echo "This is a snapshot version"
59+
exit 1
60+
fi
5461
5562
release:
5663
name: Release

.github/workflows/snapshot.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,27 @@ on:
1313
type: boolean
1414

1515
jobs:
16+
validate:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
is-snapshot: ${{ steps.validate.outputs.is-snapshot }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Validate version is a snapshot version
23+
id: validate
24+
run: |
25+
output=false
26+
if [[ "$(./mvnw -q help:evaluate -Dexpression=project.version -DforceStdout)" =~ "-SNAPSHOT" ]]; then
27+
echo "This is a snapshot version"
28+
output=true
29+
fi
30+
echo "is-snapshot=$output" >> "$GITHUB_OUTPUT"
31+
1632
deploy:
1733
name: Deploy
1834
runs-on: ubuntu-latest
19-
35+
needs: validate
36+
if: ${{ contains(needs.validate.outputs.is-snapshot, 'true') }}
2037
steps:
2138
- id: buildkite
2239
name: Run Deploy

0 commit comments

Comments
 (0)