diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 638b534..c39a904 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,6 +40,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: + ref: ${{ inputs.ref }} fetch-depth: 0 - name: Validate tag does not exist on current commit uses: ./.github/workflows/validate-tag @@ -51,6 +52,12 @@ jobs: echo "Tag should match pom.xml project.version" exit 1 fi + - name: Validate version is a release version + run: | + if [[ "$(./mvnw -q help:evaluate -Dexpression=project.version -DforceStdout)" =~ "-SNAPSHOT" ]]; then + echo "This is a snapshot version" + exit 1 + fi release: name: Release diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 26eaa79..13add95 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -13,10 +13,27 @@ on: type: boolean jobs: + validate: + 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 + echo "is-snapshot=$output" >> "$GITHUB_OUTPUT" + deploy: name: Deploy runs-on: ubuntu-latest - + needs: validate + if: ${{ contains(needs.validate.outputs.is-snapshot, 'true') }} steps: - id: buildkite name: Run Deploy