This repository has been archived by the owner on Nov 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
97 lines (82 loc) · 3.2 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Release
on:
workflow_dispatch:
pull_request_target:
branches:
- master
types:
- closed
jobs:
release:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true
outputs:
version: ${{ steps.tag_version.outputs.new_version }}
release-upload-url: ${{ steps.create_release.outputs.upload_url }}
release-html-url: ${{ steps.create_release.outputs.html_url }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: "minor"
custom_release_rules: "feat:minor:✨ Features,fix:patch:🐛 Fixes,docs:patch:📰 Docs,chore:patch:🎨 Chore,pref:patch:🎈 Performance improvements,refactor:patch:🧹 Refactoring,build:patch:🔍 Build,ci:patch:🔍 CI,revert:patch:⏪ Revert,style:patch:🧹 Style,test:patch:👀 Test"
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: adopt
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Sed Version
run: |
sed -r -i "1,/version/s#<version>(.+?)</version>#<version>${{ steps.tag_version.outputs.new_version }}</version>#" pom.xml
git diff
- name: Set PROJECT_NAME
id: vars
run: |
echo "PROJECT_NAME=`TOP=$(git rev-parse --show-toplevel); echo ${TOP##*/}`" >> $GITHUB_OUTPUT
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Publish release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
- name: Upload Release Asset
uses: shogo82148/actions-upload-release-asset@v1.6.4
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/*.jar
- name: Calculate hash
working-directory: ./target
run: |
sha256sum *.jar > sha256sum.txt
- name: Upload Release Asset sha256sum.txt
uses: shogo82148/actions-upload-release-asset@v1.6.4
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/sha256sum.txt
- name: Released comment
uses: actions/github-script@v6
if: github.event_name == 'pull_request_target'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `# リリースが完了しました\n\n${{ steps.create_release.outputs.html_url }}`
})