forked from violentmonkey/violentmonkey
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (90 loc) · 3.94 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
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
name: Release
on:
workflow_dispatch:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1 # v1 keeps tags
with:
fetch-depth: 250 # for `action-helper`
# persist-credentials: false # not implemented in v1
- uses: actions/setup-node@v3
with:
node-version: '20'
- name: Prepare
run: yarn && node scripts/action-helper.js
env:
ACTION_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
DISCORD_WEBHOOK_RELEASE: ${{ secrets.DISCORD_WEBHOOK_RELEASE }}
- name: Build
env:
SYNC_DROPBOX_CLIENT_ID: ${{ secrets.SYNC_DROPBOX_CLIENT_ID }}
SYNC_GOOGLE_CLIENT_ID: ${{ secrets.SYNC_GOOGLE_CLIENT_ID }}
SYNC_GOOGLE_CLIENT_SECRET: ${{ secrets.SYNC_GOOGLE_CLIENT_SECRET }}
SYNC_GOOGLE_DESKTOP_ID: ${{ secrets.SYNC_GOOGLE_DESKTOP_ID }}
SYNC_GOOGLE_DESKTOP_SECRET: ${{ secrets.SYNC_GOOGLE_DESKTOP_SECRET }}
SYNC_ONEDRIVE_CLIENT_ID: ${{ secrets.SYNC_ONEDRIVE_CLIENT_ID }}
SYNC_ONEDRIVE_CLIENT_SECRET: ${{ secrets.SYNC_ONEDRIVE_CLIENT_SECRET }}
run: |
mkdir -p $ASSETS_DIR $TEMP_DIR
# Create source zip
git archive @ --format=zip > $TEMP_DIR/$SOURCE_ZIP
# Include .env to ensure the output is reproducible
export | grep SYNC_ | sed -e 's/^declare -x //' > .env \
&& zip -u $TEMP_DIR/$SOURCE_ZIP .env && rm .env
# Build for release, also upload to GitHub assets
yarn build
# Build one more time to make sure the output is the same
mv dist $TEMP_DIR/dist && yarn build && diff -qr dist $TEMP_DIR/dist
cd dist && zip -r ../$ASSETS_DIR/$ASSET_ZIP . && cd ..
# Build for CWS beta, append `BETA` to version name
# Same as `BETA=1 yarn build` but only manifest is changed by now
BETA=1 npx gulp manifest
cd dist && zip -r ../$TEMP_DIR/$ASSET_CWS_BETA_ZIP . && cd ..
# Build for AMO unlisted, append `BETA` to version name and set update_url for FF
# Same as `yarn build:selfHosted` but only manifest is changed by now
TARGET=selfHosted BETA=1 npx gulp manifest
cd dist && zip -r ../$TEMP_DIR/$ASSET_SELF_HOSTED_ZIP . && cd ..
- name: Publish to AMO
continue-on-error: true
run: |
mkdir -p $TEMP_DIR/updates
if [ "$PRERELEASE" != "true" ]; then
echo Publish listed version
node scripts/amo-upload.mjs
else
echo Publish unlisted version
DEBUG=amo-upload BETA=1 node scripts/amo-upload.mjs
fi
env:
AMO_KEY: ${{ secrets.AMO_KEY }}
AMO_SECRET: ${{ secrets.AMO_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Try to publish if not exist
AMO_PUBLISH: true
- name: Publish to CWS
continue-on-error: true
run: |
set -x
if [ "$PRERELEASE" != "true" ]; then
echo Publish release
npx chrome-webstore-upload-cli@1 upload --extension-id $EXTENSION_ID_RELEASE --source $ASSETS_DIR/$ASSET_ZIP --auto-publish
else
echo Publish prerelease
npx chrome-webstore-upload-cli@1 upload --extension-id $EXTENSION_ID_BETA --source $TEMP_DIR/$ASSET_CWS_BETA_ZIP --auto-publish
fi
env:
EXTENSION_ID_BETA: opokoaglpekkimldnlggpoagmjegichg
EXTENSION_ID_RELEASE: jinjaccalgkegednnccohejagnlnfdag
CLIENT_ID: ${{ secrets.CWS_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CWS_CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.CWS_REFRESH_TOKEN }}
- name: Create/Update Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
node -e 'import("./scripts/release-helper.mjs").then(({ uploadAssets }) => uploadAssets())';