-
-
Notifications
You must be signed in to change notification settings - Fork 24
80 lines (79 loc) · 2.67 KB
/
choco-push.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
# @deprecated use semantic-release
# ref [自动化发布npm包及生成Github Changelog]( https://banyudu.com/posts/auto_publish_npm_and_generate_github_changelog.882513 )
on:
push:
tags:
- "v*"
#
name: chocolatey publish
jobs:
chocolatey-push:
if: github.repository == 'snolab/CapsLockX'
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
# 打包 校验
- run: choco install zip checksum
# TODO 搞个缓存
# - uses: actions/cache@v1
# id: env_cache
# with:
# path: # TODO
# key: ${{ runner.os }}-# TODO
# 这个 step 需要干净的环境所以不要在本地运行。
- run: |
zip -r CapsLockX.zip Core Data docs Modules Tools *.ahk *.txt *.md *.exe
checksum -t sha256 -f CapsLockX.zip > CapsLockX.sha256
cp -force CapsLockX.zip ./DevTools/choco/tools/
cp -force CapsLockX.sha256 ./DevTools/choco/tools/
choco pack ./DevTools/choco/CapsLockX.nuspec
# 测试
- run: choco install CapsLockX -s .
# 准备上传到releases
- uses: actions/upload-artifact@v2
with:
name: CapsLockX.zip
path: ./CapsLockX.zip
- uses: actions/upload-artifact@v2
with:
name: CapsLockX.sha256
path: ./CapsLockX.sha256
# 上传 nupkg 用来给 chocolatey push
- run: mv CapsLockX.*.nupkg CapsLockX.nupkg
- uses: actions/upload-artifact@v2
with:
name: CapsLockX.nupkg
path: ./CapsLockX.nupkg
# 发布
- run: choco apikey --key ${{ secrets.CHOCOLATEY_APIKEY }} --source https://push.chocolatey.org/
- run: choco push --source https://push.chocolatey.org/
github-pages-choco-version-upload:
runs-on: ubuntu-latest
needs: chocolatey-push
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: CapsLockX.zip
- uses: actions/download-artifact@v2
with:
name: CapsLockX.sha256
- uses: actions/download-artifact@v2
with:
name: CapsLockX.nupkg
# 压缩包和 sha256 一起扔附件
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: CapsLockX.zip
tag: ${{ github.ref }}
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: CapsLockX.sha256
tag: ${{ github.ref }}
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: CapsLockX.nupkg
tag: ${{ github.ref }}