Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(snapshot): skip deploy if no snapshot version or release version #238

Merged
merged 7 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ jobs:
echo "Tag should match pom.xml project.version"
exit 1
fi
- name: Validate version is a release version
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, the pom.xml version is a snapshot.

run: |
if [[ "$(./mvnw -q help:evaluate -Dexpression=project.version -DforceStdout)" =~ "-SNAPSHOT" ]]; then
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved
echo "This is a snapshot version"
exit 1
fi

release:
name: Release
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,30 @@ on:
type: boolean

jobs:
validate:
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
outputs:
is-snapshot: ${{ steps.validate.outputs.is-snapshot }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/maven-goal
with:
command: './mvnw -q help:evaluate -Dexpression=project.version -DforceStdout'
v1v marked this conversation as resolved.
Show resolved Hide resolved
- name: Validate version is a snapshot version
id: validate
run: |
output=false
if [[ "$(./mvnw -q help:evaluate -Dexpression=project.version -DforceStdout)" =~ "-SNAPSHOT" ]]; then
echo "This is a snapshot version"
output=true
fi
amannocci marked this conversation as resolved.
Show resolved Hide resolved
echo "is-snapshot=$output" >> "$GITHUB_OUTPUT"

deploy:
name: Deploy
runs-on: ubuntu-latest

needs: validate
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ contains(needs.validate.outputs.is-snapshot, 'true') }}
steps:
- id: buildkite
name: Run Deploy
Expand Down
Loading