-
Notifications
You must be signed in to change notification settings - Fork 61
134 lines (126 loc) · 5.22 KB
/
package.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
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
name: Build packages
on:
workflow_call:
inputs:
event_name:
required: true
type: string
jobs:
install-schema:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Schemata
run: |
chmod u+x ./.ci/*
export rime_dir=schema
./.ci/install-schema.sh
- name: Upload Schemata
uses: actions/upload-artifact@v4
with:
name: install-schema
if-no-files-found: error
path: schema
package-windows:
needs: install-schema
runs-on: windows-2019
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Get Weasel Version
shell: bash
run: |
echo "WEASEL_VERSION=$(git ls-remote --tags --refs --sort="v:refname" https://github.com/rime/weasel.git | grep -v '/latest$' | tail -n1 | sed 's/.*\///')" >> $GITHUB_ENV
- id: check_version
name: Compare Weasel Version
if: inputs.event_name == 'schedule'
shell: bash
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
RELEASED_FILES=$(gh release view latest --json assets --jq '.assets[].name')
WEASEL_RELEASED_VERSION=$(echo "$RELEASED_FILES" | grep 'weasel-.*' | sed 's/weasel-\([^-]*\).*/\1/')
if [ "$WEASEL_VERSION" = "$WEASEL_RELEASED_VERSION" ]; then
echo "Weasel version is up to date. Skipping package."
exit 1
- name: Download Schemata
if: inputs.event_name != 'schedule' || steps.check_version.outcome == 'success'
uses: actions/download-artifact@v4
with:
name: install-schema
path: schema
- name: Package Weasel
if: inputs.event_name != 'schedule' || steps.check_version.outcome == 'success'
shell: bash
run: |
export PATH="/c/msys64/usr/bin:$PATH" # wget
export SCHEMA_DIR="$PWD/schema"
./.ci/package-windows.sh
- name: Upload Artifact
if: inputs.event_name != 'schedule' || steps.check_version.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: package-windows
if-no-files-found: error
path: ./output/archives/weasel-*.exe
package-mac:
needs: install-schema
runs-on: macos-14
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Get Squirrel Version
run: |
echo "SQUIRREL_VERSION=$(git ls-remote --tags --refs --sort="v:refname" https://github.com/rime/squirrel.git | grep -v '/latest$' | tail -n1 | sed 's/.*\///')" >> $GITHUB_ENV
- id: check_version
name: Compare Squirrel Version
if: inputs.event_name == 'schedule'
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
RELEASED_FILES=$(gh release view latest --json assets --jq '.assets[].name')
SQUIRREL_RELEASED_VERSION=$(echo "$RELEASED_FILES" | grep 'Squirrel-.*' | sed 's/Squirrel-\([^-]*\).*/\1/')
if [ "$SQUIRREL_VERSION" = "$SQUIRREL_RELEASED_VERSION" ]; then
echo "Squirrel version is up to date. Skipping package."
exit 1
- name: Download Schemata
if: inputs.event_name != 'schedule' || steps.check_version.outcome == 'success'
uses: actions/download-artifact@v4
with:
name: install-schema
path: schema
- name: Package Squirrel
if: inputs.event_name != 'schedule' || steps.check_version.outcome == 'success'
env:
APPLE_DEVELOPER_NAME: ${{ secrets.APPLE_DEVELOPER_NAME }}
APPLE_DEVELOPER_TEAM_ID: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }}
APPLE_CONNECT_USERNAME: ${{ secrets.APPLE_CONNECT_USERNAME }}
APPLE_CONNECT_PASSWORD: ${{ secrets.APPLE_CONNECT_PASSWORD }}
APPLICATION_CERTIFICATE: ${{ secrets.APPLICATION_CERTIFICATE }}
APPLICATION_CERTIFICATE_PASSWORD: ${{ secrets.APPLICATION_CERTIFICATE_PASSWORD }}
INSTALLER_CERTIFICATE: ${{ secrets.INSTALLER_CERTIFICATE }}
INSTALLER_CERTIFICATE_PASSWORD: ${{ secrets.INSTALLER_CERTIFICATE_PASSWORD }}
run: |
chmod u+x ./.ci/*
KEYCHAIN_PATH=~/Library/Keychains/squirrel.keychain
KEYCHAIN_PASSWORD=squirrel
security create-keychain -p "$KEYCHAIN_PASSWORD" squirrel.keychain
echo "$APPLICATION_CERTIFICATE" | base64 -d > application_certificate.p12
security import application_certificate.p12 -k "$KEYCHAIN_PATH" -P "$APPLICATION_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
echo "$INSTALLER_CERTIFICATE" | base64 -d > installer_certificate.p12
security import installer_certificate.p12 -k "$KEYCHAIN_PATH" -P "$INSTALLER_CERTIFICATE_PASSWORD" -T /usr/bin/productsign
security list-keychain -s "$KEYCHAIN_PATH"
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security set-key-partition-list -S apple-tool:,apple:,codesign:,productsign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
export SCHEMA_DIR="$PWD/schema"
./.ci/package-mac.sh
- name: Upload Artifact
if: inputs.event_name != 'schedule' || steps.check_version.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: package-mac
if-no-files-found: error
path: ./output/Squirrel-*.pkg