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 all 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
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
Copy link
Member Author

Choose a reason for hiding this comment

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

Fail fast if the ref is not correct. Otherwise, it's required to wait for the Buildkite pipeline to run

fetch-depth: 0
- name: Validate tag does not exist on current commit
uses: ./.github/workflows/validate-tag
Expand All @@ -51,6 +52,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
19 changes: 18 additions & 1 deletion .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,27 @@ 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
- 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