-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (50 loc) · 1.96 KB
/
ci.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
name: Sillot Android CI
on:
push:
tags:
- "v*"
jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_version: ${{ steps.release_info.outputs.release_version }}
version: ${{ steps.version.outputs.value }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- run: pip install PyGithub
- name: Gather Sillot Release Information
id: release_info
# https://github.com/Hi-Windom/Sillot/issues/373
# 注意:创建或更新环境变量的步骤无权访问新值;$GITHUB_OUTPUT 需要定义步骤 id 才能稍后检索输出值,$GITHUB_ENV 则不需要
# 以下转换不再需要:
# changelog="${changelog//'%'/'%25'}"
# changelog="${changelog//$'\n'/'%0A'}"
# changelog="${changelog//$'\r'/'%0D'}"
run: |
echo "release_title=$(git show --format=%s --no-patch | head -1)" >> $GITHUB_OUTPUT
echo "release_version=${{ github.ref }}_$(TZ=Asia/Shanghai date +'%Y%m%d')" >> $GITHUB_OUTPUT
changelog=$(python scripts/release.py -t ${{ github.ref }} Hi-Windom/Sillot)
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "release_body_sillot<<$EOF" >> $GITHUB_ENV
echo "$changelog" >> $GITHUB_ENV
echo "$EOF" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_name: ${{ steps.release_info.outputs.release_version }}
tag_name: ${{ github.ref }}
body: "${{ env.release_body_sillot }}"
draft: false
prerelease: true