-
Notifications
You must be signed in to change notification settings - Fork 58
232 lines (222 loc) · 8.85 KB
/
release.yaml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: release
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+*
jobs:
# validate:
# uses: ./.github/workflows/validate.yaml
parse_tag:
runs-on: ubuntu-22.04
outputs:
is_stable_version: ${{ steps.parse.outputs.is_stable_version }}
version: ${{ steps.parse.outputs.version }}
steps:
- id: parse
run: |
echo "is_stable_version=$([[ $GITHUB_REF_NAME =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo true || echo false)" >> $GITHUB_OUTPUT
echo "version=${GITHUB_REF_NAME:1}" >> $GITHUB_OUTPUT
# pypi:
# needs: validate
# runs-on: ubuntu-22.04
# permissions:
# id-token: write
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: 3.9
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install --upgrade poetry
# poetry install
# - run: poetry build
# - uses: actions/upload-artifact@v3
# with:
# name: pypi
# path: dist/*
# if-no-files-found: error
# - uses: pypa/gh-action-pypi-publish@release/v1
# brew:
# # the Formula references the rclip package published to PyPI
# needs: [validate, parse_tag, pypi]
# if: needs.parse_tag.outputs.is_stable_version == 'true'
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: 3.9
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install --upgrade poetry
# poetry install
# - name: Setup git
# run: |
# git config --global user.email "[email protected]"
# git config --global user.name "Zhi Bot"
# - run: make release-brew
# env:
# GITHUB_TOKEN: ${{ secrets.ZHIBOT_GITHUB_TOKEN }}
# snap:
# needs: [validate, parse_tag]
# runs-on: ubuntu-20.04
# steps:
# - uses: actions/checkout@v3
# - name: Configure git for "snapcraft remote-build"
# run: |
# git config --global user.email "[email protected]"
# git config --global user.name "Yurij Mikhalevich"
# - name: Setup launchpad creds
# run: |
# mkdir -p ~/.local/share/snapcraft/provider/launchpad
# echo "${{ secrets.LAUNCHPAD_CREDENTIALS }}" > ~/.local/share/snapcraft/provider/launchpad/credentials
# - uses: actions/setup-python@v4
# with:
# python-version: 3.9
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install --upgrade poetry
# poetry install
# - name: Build wheel
# run: |
# poetry build
# mkdir snap/local
# cp -v dist/rclip-*.tar.gz snap/local
# - run: sudo snap install snapcraft --classic
# - run: |
# export SNAPCRAFT_REMOTE_BUILD_STRATEGY="force-fallback"
# snapcraft remote-build --launchpad-accept-public-upload
# - name: Validate built snap
# run: |
# sudo snap install rclip_*_amd64.snap --dangerous
# rclip cat
# - name: Upload snaps to the beta channel
# run: |
# for snap in *.snap; do
# snapcraft upload --release=beta "$snap"
# done
# env:
# SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_LOGIN }}
# - name: Promote snaps to the stable channel
# if: needs.parse_tag.outputs.is_stable_version == 'true'
# run: snapcraft promote --from-channel=beta --to-channel=stable --yes rclip
# env:
# SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_LOGIN }}
# - name: Rename snaps for GitHub releases page
# run: |
# for snap in *.snap; do
# mv "$snap" "${snap//_/-}"
# done
# - uses: actions/upload-artifact@v3
# with:
# name: snap
# path: rclip-*.snap
# if-no-files-found: error
# appimage:
# needs: [parse_tag, validate]
# runs-on: ubuntu-20.04
# steps:
# - uses: actions/checkout@v3
# - name: Set up APPDIR for after_bundle
# run: echo "APPDIR=$PWD/AppDir" >> $GITHUB_ENV
# - name: Build AppImage
# uses: AppImageCrafters/[email protected]
# with:
# recipe: './release-utils/appimage/appimage-builder.yml'
# env:
# APP_VERSION: ${{ needs.parse_tag.outputs.version }}
# - name: Rename AppImage for GitHub releases page
# run: mv rclip-${{ needs.parse_tag.outputs.version }}-x86_64.AppImage rclip-${{ needs.parse_tag.outputs.version }}-amd64.AppImage
# - uses: actions/upload-artifact@v3
# with:
# name: appimage
# path: rclip-*.AppImage
# if-no-files-found: error
windows:
# needs: [parse_tag, validate]
needs: parse_tag
# if: needs.parse_tag.outputs.is_stable_version == 'true'
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade poetry
poetry install
poetry run pip install pyinstaller==6.10.0
- run: make build-windows
- name: Install Advinst
uses: caphyon/advinst-github-action@main
with:
advinst-version: '21.1'
advinst-enable-automation: 'true'
# - run: |
# & ./release-utils/windows/build-msi.ps1 "${{ needs.parse_tag.outputs.version }}"
# mv build-msi/rclip-SetupFiles/rclip.msi build-msi/rclip-SetupFiles/rclip-${{ needs.parse_tag.outputs.version }}.msi
- run: |
& ./release-utils/windows/build-msi.ps1 "0.1.2"
mv build-msi/rclip-SetupFiles/rclip.msi build-msi/rclip-SetupFiles/rclip-0.1.2.msi
# - name: Sign MSI
# run: |
# mkdir signed
# Invoke-WebRequest -URI https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/11/CodeSignTool-v1.2.7-windows.zip -OutFile CodeSignTool.zip
# if ( ( Get-FileHash -Algorithm SHA256 CodeSignTool.zip ).Hash -ne 'AC9CDBFF6D482DBC1107ABC8789570F57ECF85773332BBA466CB3E00CE0BB841' ) { throw 'hash does not match' }
# Expand-Archive -Path CodeSignTool.zip -DestinationPath .
# cd CodeSignTool-v1.2.7-windows
# & ./CodeSignTool.bat sign -input_file_path="${env:GITHUB_WORKSPACE}/build-msi/rclip-SetupFiles/rclip-${{ needs.parse_tag.outputs.version }}.msi" -username=${{ secrets.WINDOWS_SIGNING_USERNAME }} -credential_id='${{ secrets.WINDOWS_SIGNING_CREDENTIAL_ID }}' -password='${{ secrets.WINDOWS_SIGNING_PASSWORD }}' -totp_secret='${{ secrets.WINDOWS_SIGNING_TOTP_SECRET }}' -output_dir_path="${env:GITHUB_WORKSPACE}/signed"
- uses: actions/upload-artifact@v3
with:
name: windows
# path: signed/rclip-*.msi
path: build-msi/rclip-SetupFiles/rclip-0.1.2.msi
if-no-files-found: error
windows-validate:
needs: windows
runs-on: windows-2022
steps:
- uses: actions/download-artifact@v3
with:
name: windows
- name: Install MSI
run: |
Start-Process msiexec.exe -Wait -ArgumentList '/i rclip-0.1.2.msi /quiet'
Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1"
refreshenv
- name: Ensure it works
run: rclip cat
# create_release:
# needs: [parse_tag, pypi, snap, appimage, windows-validate]
# # the windows job doesn't run for pre-releases, but we need to create a release for pre-releases too
# if: ${{ !cancelled() }}
# runs-on: ubuntu-22.04
# steps:
# # if any of the needs jobs fail, we don't want to create a release
# # this is needed because of `if: ${{ !cancelled() }}` above
# - if: ${{ contains(needs.*.result, 'failure') }}
# run: exit 1
# - uses: actions/checkout@v3
# - uses: actions/download-artifact@v3
# with:
# path: artifacts/
# - name: Generate Changelog
# run: |
# git fetch --unshallow
# PREVIOUS_TAG="$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))"
# git --no-pager log --pretty="format:- %s" $PREVIOUS_TAG..$GITHUB_REF_NAME > release_changelog.md
# cat release_changelog.md
# - name: Create Release
# uses: ncipollo/release-action@v1
# with:
# name: ${{ github.ref_name }}
# artifacts: artifacts/pypi/rclip-*,artifacts/snap/rclip-*.snap,artifacts/appimage/rclip-*.AppImage,artifacts/windows/rclip-*.msi
# bodyFile: release_changelog.md
# prerelease: ${{ needs.parse_tag.outputs.is_stable_version == 'false' }}
# token: ${{ secrets.GITHUB_TOKEN }}