Skip to content

Commit

Permalink
Release a new version with GitHub Actions (#887)
Browse files Browse the repository at this point in the history
Motivation:

If releases are performed through an automated task, mistakes can be reduced and more validation can be added.

Modifications:

- Add `tag-new-release.yml` to tag a new version with GitHub Actions dispatch UI.

Result:

Automated release process
  • Loading branch information
ikhoon authored Oct 30, 2023
1 parent ca1ca56 commit 5fc9d30
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 4 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/tag-new-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release a new Central Dogma version
on:
workflow_dispatch:
inputs:
release_version:
description: 'Release Version'
required: true
type: string
next_version:
description: 'Next Version'
required: true
type: string

env:
LC_ALL: "en_US.UTF-8"

jobs:
tag-new-version:
if: github.repository == 'line/centraldogma'
runs-on: ubuntu-latest

steps:
- name: Validate inputs
run: |
if [[ ! "${{ inputs.release_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: 'release_version' should be in SemVer format."
exit 1
fi
if [[ ! "${{ inputs.next_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: 'next_version' should be in SemVer format."
exit 1
fi
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Set up Git remote
run: |
git remote set-url origin https://github.com/line/centraldogma.git
shell: bash

- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSWORD }}
git_user_signingkey: true
git_commit_gpgsign: true

- id: setup-jdk-17
name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Set up Gradle
uses: gradle/gradle-build-action@v2

- name: Bump up version
run: |
./gradlew --no-daemon --stacktrace --max-workers=1 release \
-PreleaseVersion=${{ inputs.release_version }} \
-PnextVersion=${{ inputs.next_version }}
shell: bash
8 changes: 4 additions & 4 deletions .github/workflows/update-armeria-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v3
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSWORD }}
git-user-signingkey: true
git-commit-gpgsign: true
git_user_signingkey: true
git_commit_gpgsign: true

- name: Create pull request
uses: peter-evans/create-pull-request@v4
Expand Down

0 comments on commit 5fc9d30

Please sign in to comment.