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

Release - New GitHub workflow for releasing #1847

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
17 changes: 5 additions & 12 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
name: Publish Release

# Every time we merge to main branch we publish a release.
# Every time we trigger the workflow on a branch.
on:
push:
branches: [ main ]
workflow_dispatch:

jobs:

publish-release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: main

- name: Set up JDK
uses: actions/setup-java@v4
Expand All @@ -33,8 +29,6 @@ jobs:
- name: Gradle check
run: ./gradlew check

# TODO: add more tests or rely on check_release workflow?

# Base64 decodes and pipes the GPG key content into the secret file
- name: Prepare environment
env:
Expand All @@ -48,8 +42,8 @@ jobs:
- name: Publish to Maven Central
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 --stacktrace
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
Expand All @@ -73,9 +67,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitish: main
tag_name: ${{ env.PROJECT_VERSION }}
release_name: ${{ env.PROJECT_VERSION }}
body_path: ${{ github.workspace }}/RELEASE_NOTES.md
draft: false
draft: true
prerelease: false
81 changes: 81 additions & 0 deletions .github/workflows/publish_release_old.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Publish Release - Old

# Every time we merge to main branch we publish a release.
on:
push:
branches: [ main ]
workflow_dispatch:

jobs:

publish-release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: main

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Gradle cache
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: true

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Gradle check
run: ./gradlew check

# TODO: add more tests or rely on check_release workflow?

# Base64 decodes and pipes the GPG key content into the secret file
- name: Prepare environment
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
run: |
git fetch --unshallow
sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"

# Packages and publishes to Maven Central
- name: Publish to Maven Central
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 --stacktrace
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}

# Get the version name from a script and save to environment variable.
- name: Set PROJECT_VERSION
run: |
echo "▸ Set run permission."
chmod +x scripts/version_name.sh
echo "▸ Getting version name"
PROJECT_VERSION=$(./scripts/version_name.sh)
araratthehero marked this conversation as resolved.
Show resolved Hide resolved
echo "▸ Variable PROJECT_VERSION set to: ${PROJECT_VERSION}"
echo "▸ Adding PROJECT_VERSION variable with: $PROJECT_VERSION"
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
echo "▸ DONE"

# Create the Release TAG and notes.
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitish: main
tag_name: ${{ env.PROJECT_VERSION }}
release_name: ${{ env.PROJECT_VERSION }}
body_path: ${{ github.workspace }}/RELEASE_NOTES.md
draft: false
prerelease: false