forked from bkdevops-projects/devops-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (70 loc) · 2.58 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# 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: 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