forked from Schweigen1213/bilibili-helper-pro
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (71 loc) · 2.96 KB
/
auto_package_bilibili-helper.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
name: auto_package_bilibili-helper-pro
on:
push:
branches:
- main
paths:
- ".github/release.json"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
# 从release.json 读取相关信息
- name: Read tag_main
id: tag_main
uses: ashley-taylor/read-json-property-action@v1.0
with:
path: ./.github/release.json
property: tag_main
- name: Read tag_latest
id: tag_latest
uses: ashley-taylor/read-json-property-action@v1.0
with:
path: ./.github/release.json
property: tag_latest
- name: Read description
id: description
uses: juliangruber/read-file-action@v1
with:
path: ./.github/release.info
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Package with Maven
run: mvn -B package assembly:single --file pom.xml -Dmaven.test.skip=true
- name: ZIP files
run: |
mv -f ./target/bilibili-helper-pro-${{steps.tag_main.outputs.value}}-jar-with-dependencies.jar bilibili-helper-pro-v${{steps.tag_latest.outputs.value}}.jar
zip bilibili-helper-pro\ v${{steps.tag_latest.outputs.value}}.zip bilibili-helper-pro-v${{steps.tag_latest.outputs.value}}.jar
zip -m bilibili-helper-pro\ v${{steps.tag_latest.outputs.value}}.zip LICENSE
zip -m bilibili-helper-pro\ v${{steps.tag_latest.outputs.value}}.zip README.md
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: V${{steps.tag_latest.outputs.value}}
release_name: bilibili-helper-pro-v${{steps.tag_latest.outputs.value}}
body: |
${{steps.description.outputs.content}}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./bilibili-helper-pro v${{steps.tag_latest.outputs.value}}.zip
asset_name: bilibili-helper-pro-v${{steps.tag_latest.outputs.value}}.zip
asset_content_type: application/zip