-
Notifications
You must be signed in to change notification settings - Fork 33
116 lines (101 loc) · 3.9 KB
/
publish.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
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
---
name: Publish
on:
release:
types: [published]
permissions:
contents: write
jobs:
release:
name: "Release"
runs-on: ubuntu-latest
environment: ${{ github.event.release.prerelease && 'beta' || 'release' }}
steps:
- name: "All: Checkout"
uses: actions/checkout@v4
- name: "All: npm ci"
run: npm ci
- name: "All: npm run lint"
run: npm run lint
- name: "Beta: Add update_url to manifest"
if: ${{ github.event.release.prerelease }}
run: |
jq '.browser_specific_settings.gecko.update_url = "https://kewisch.github.io/gdata-provider/update.json"' \
src/manifest.json > src/manifest.json~
diff -u src/manifest.json src/manifest.json~
mv src/manifest.json~ src/manifest.json
- name: "All: Adjust OAuth keys"
env:
KEYS: ${{ secrets.OAUTH_KEYS }}
FILENAME: ${{ github.event.release.prerelease && 'src/background/session.js' || 'src/legacy/modules/gdataSession.sys.mjs' }}
run: |
if [ -z "$KEYS" ]
then
exit 0
fi
awk -v keys "$KEYS" '
/\/\* BEGIN OAUTH \*\// {print; inside=1; print keys"; next}
/\/\* END OAUTH \*\// {inside=0}
!inside
' $FILENAME > $FILENAME~
diff -u $FILENAME $FILENAME~
mv $FILENAME~ $FILENAME
- name: "All: Build"
run: npm run build
# - name: "Release: web-ext sign"
# if: ${{ ! github.event.release.prerelease }}
# uses: kewisch/action-web-ext@v1
# with:
# cmd: sign
# source: dist/gdata-provider.xpi
# channel: listed
# apiUrlPrefix: "https://addons.thunderbird.net/api/v4"
# apiKey: ${{ secrets.AMO_SIGN_KEY }}
# apiSecret: ${{ secrets.AMO_SIGN_SECRET }}
- name: "Beta: Checkout gh_pages"
if: ${{ github.event.release.prerelease }}
uses: actions/checkout@v4
with:
branch: gh_pages
path: gh_pages
fetch-depth: 0
- name: "Beta: Add new release to updates.json"
if: ${{ github.event.release.prerelease }}
working-directory: gh_pages
env:
TAG_NAME: ${{ github.event.release.tag_name }}
run: |
jq --arg tag_name $TAG_NAME -s '
.[0].addons[.[1].browser_specific_settings.gecko.id].updates =
[{
version: .[1].version,
update_link: "https://github.com/kewisch/gdata-provider/releases/download/\($tag_name)/gdata-provider.xpi",
applictions: {
gecko: {
strict_min_version: .[1].browser_specific_settings.gecko.strict_min_version,
strict_max_version: .[1].browser_specific_settings.gecko.strict_max_version
}
}
}] + .[0].addons[.[1].browser_specific_settings.gecko.id].updates | .[0]
' update.json ../src/manifest.json > update.json~
diff -u update.json update.json~
mv update.json~ update.json
- name: "All: Attach release assets"
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ github.event.release.tag_name }} \
dist/gdata-provider.xpi
- name: "Beta: Push back gh_pages"
if: ${{ github.event.release.prerelease }}
working-directory: gh_pages
env:
TAG_NAME: ${{ github.event.release.tag_name }}
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git diff
#git commit -a -m "Release $TAG_NAME"