Skip to content

Commit

Permalink
fix: update snapshot release workflows (#983)
Browse files Browse the repository at this point in the history
* feat: configure checked out ref

Signed-off-by: Chris Laprun <[email protected]>

* wip: check snapshot release

Signed-off-by: Chris Laprun <[email protected]>

* wip: switch to new release snapshot workflow

Signed-off-by: Chris Laprun <[email protected]>

* wip: rename to try to trigger it

Signed-off-by: Chris Laprun <[email protected]>

* wip: try to activate new snapshot workflow

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
  • Loading branch information
metacosm authored Oct 30, 2024
1 parent ab88f33 commit 7d53d84
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 43 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/release-perform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
tag:
description: 'Tag to release'
required: true
ref:
description: 'Branch or tag to deploy'
type: string
required: false
dry_run:
description: 'Dry run the release'
required: false
Expand Down Expand Up @@ -47,7 +51,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
ref: ${{github.ref}}
ref: ${{inputs.ref || github.ref}}

- name: Gather versions
id: versions
Expand Down
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,11 +10,6 @@ defaults:

jobs:
release-snapshot:
uses: ./.github/workflows/release-snapshot.yml
uses: release-snapshot.yml
with:
branch: "${{github.ref}}"
secrets:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
branch: "${{github.ref}}"
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 7d53d84

Please sign in to comment.