Release #6
This file contains hidden or 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
# Releases can only from release-** branch | |
name: Release | |
on: | |
# Releases can only be triggered via the action tab | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
outputs: | |
RELEASE_VERSION: ${{ steps.get-version.outputs.RELEASE_VERSION }} | |
steps: | |
- name: check branch | |
if: startsWith(github.ref_name,'release-') != true | |
run: | | |
echo "Releases can only from release-** branch" | |
exit 1 | |
- name: Get version | |
id: get-version | |
run: | | |
branch_name="${{ github.ref_name }}" | |
version=${branch_name#release-} | |
echo "RELEASE_VERSION=$version" >> $GITHUB_ENV | |
echo "RELEASE_VERSION=$version" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v2 | |
- name: Generate changelog | |
id: generate-changelog | |
run: | | |
CONFIG_DIR=$(pwd)/.github/config | |
docker run --rm -v $CONFIG_DIR:/generated-changelog springio/github-changelog-generator:0.0.8 \ | |
java -jar -Dfile.encoding=utf-8 github-changelog-generator.jar \ | |
--spring.config.location=/generated-changelog/changelog-generator.yml \ | |
--github.username=${{ github.actor }} \ | |
--github.password=${{ secrets.GITHUB_TOKEN }} \ | |
${{ env.RELEASE_VERSION }} \ | |
/generated-changelog/changelog.md | |
echo "::set-output name=changelog_path::$CONFIG_DIR/changelog.md" | |
- name: Setup git configuration | |
run: | | |
git config user.name "bkci-bot" | |
git config user.email "64278246+bkci-bot@users.noreply.github.com" | |
- name: Create tag | |
run: git tag v${{ env.RELEASE_VERSION }} -m "Release v${{ env.RELEASE_VERSION }}" | |
- name: Push git tag | |
run: git push origin v${{ env.RELEASE_VERSION }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.RELEASE_VERSION }} | |
release_name: v${{ env.RELEASE_VERSION }} | |
body_path: ${{ steps.generate-changelog.outputs.changelog_path }} | |
deploy-release: | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: v${{ needs.release.outputs.RELEASE_VERSION }} | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 8 | |
- name: Set up Node JS | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Publish release package | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | |
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} | |
run: ./gradlew publish |