-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1847 from Adyen/chore/new_github_action_for_relea…
…sing Release - New GitHub workflow for releasing
- Loading branch information
Showing
2 changed files
with
86 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
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 |