-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (44 loc) · 1.69 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
name: Release on commit
on:
push:
branches:
- main
paths-ignore:
- '.github/**'
workflow_dispatch:
jobs:
release:
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.event.head_commit.message, 'release-') }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
token: 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 # 使用个人访问令牌替代默认的 GITHUB_TOKEN
- name: Archive source code
run: |
git submodule update --init --recursive
zip -r source-code.zip .
- name: Get commit ID
id: get_commit
run: echo "commit_id=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: v${{ github.run_number }}
release_name: ${{ env.commit_id }}
body: |
Release notes for commit ${{ env.commit_id }}.
draft: false
prerelease: false
token: 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 # 使用个人访问令牌替代默认的 GITHUB_TOKEN
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./source-code.zip
asset_name: source-code.zip
asset_content_type: application/zip
token: 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 # 使用个人访问令牌替代默认的 GITHUB_TOKEN