Skip to content

Commit

Permalink
wip: switch to new release snapshot workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Laprun <[email protected]>
  • Loading branch information
metacosm committed Oct 30, 2024
1 parent 1a53689 commit 00fa7d7
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 107 deletions.
71 changes: 0 additions & 71 deletions .github/workflows/deploy-snapshot.yml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/release-snapshot-old.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Release snapshot

on:
workflow_call:
inputs:
branch:
type: string
required: false
default: 'main'
version:
type: string
required: false
secrets:
GPG_PRIVATE_KEY:
required: true
OSSRH_USERNAME:
required: true
OSSRH_TOKEN:
required: true
GPG_PASSPHRASE:
required: true

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
release-snapshot:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: "${{inputs.branch}}"

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Change version to "${{inputs.version}}" if needed
if: ${{ inputs.version != '' }}
run: |
echo "Set version to ${{inputs.version}}"
./mvnw versions:set -DnewVersion="${{inputs.version}}" versions:commit -Puse-snapshots
- name: Output information
run: echo "Release snapshot for branch ${{inputs.branch}} with version $(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)"

- name: Deploy maven snapshot
run: |
./mvnw -B deploy -DperformRelease -Dno-samples -Dno-docs -Prelease,use-snapshots
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defaults:

jobs:
release-snapshot:
uses: ./.github/workflows/release-snapshot.yml
uses: release-snapshot-old.yml
with:
branch: "${{github.ref}}"
secrets:
Expand Down
75 changes: 40 additions & 35 deletions .github/workflows/release-snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release snapshot
name: Deploy Snapshot

on:
workflow_call:
workflow_dispatch:
inputs:
branch:
type: string
Expand All @@ -10,28 +10,33 @@ on:
version:
type: string
required: false
secrets:
GPG_PRIVATE_KEY:
required: true
OSSRH_USERNAME:
required: true
OSSRH_TOKEN:
required: true
GPG_PASSPHRASE:
required: true

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
workflow_call:
inputs:
branch:
type: string
required: false
default: 'main'
version:
type: string
required: false

defaults:
run:
shell: bash

permissions:
attestations: write
id-token: write
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release-snapshot:
prepare-version:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
Expand All @@ -40,27 +45,27 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Change version to "${{inputs.version}}" if needed
- name: Retrieve and export project version
run: |
version=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "Project version: ${version}"
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Override project version if requested
if: ${{ inputs.version != '' }}
run: |
echo "Set version to ${{inputs.version}}"
./mvnw versions:set -DnewVersion="${{inputs.version}}" versions:commit -Puse-snapshots
echo "Version override requested: ${{inputs.version}}"
echo "version=${{inputs.version}}" >> $GITHUB_OUTPUT
- name: Output information
run: echo "Release snapshot for branch ${{inputs.branch}} with version $(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)"

- name: Deploy maven snapshot
run: |
./mvnw -B deploy -DperformRelease -Dno-samples -Dno-docs -Prelease,use-snapshots
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
deploy-snapshot:
name: Deploy Snapshots
uses: quarkiverse/.github/.github/workflows/perform-release.yml@main
secrets: inherit
needs:
- prepare-version
with:
ref: main
version: ${{needs.prepare-version.outputs.version}}

0 comments on commit 00fa7d7

Please sign in to comment.