-
-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (72 loc) · 2.72 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
name: Release
permissions:
id-token: write
contents: write
on:
release:
types:
- published
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Build
env:
VERSION: ${{ github.event.release.tag_name }}
run: make
- name: Upload to GitHub release assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPLOAD_URL: ${{ github.event.release.upload_url }}
VERSION: ${{ github.event.release.tag_name }}
run: |
set +e
for variant in firefox chrome; do
name="mergify-${variant}-${VERSION}.zip"
curl -L \
--fail \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@${name}" \
"${UPLOAD_URL%%/assets*}/assets?name=${name}"
if [ $? = 22 ]; then
echo "Upload of $name failed"
exit 22
fi
done
set -e
- name: Setup Google Auth 🔧
id: auth
# yamllint disable-line rule:line-length
# nosemgrep: yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha.third-party-action-not-pinned-to-commit-sha
uses: google-github-actions/auth@v2
with:
# yamllint disable-line rule:line-length
workload_identity_provider: projects/306279023132/locations/global/workloadIdentityPools/github/providers/github
service_account: github-actions@chrome-web-store-api-435512.iam.gserviceaccount.com
token_format: access_token
- name: Upload to Google Web Store
env:
VERSION: ${{ github.event.release.tag_name }}
GOOGLE_CHROME_WEBSTORE_APP_ID: ${{ secrets.GOOGLE_CHROME_WEBSTORE_APP_ID }}
GOOGLE_CHROME_WEBSTORE_TOKEN: ${{ steps.auth.outputs.access_token }}
run: |
name="mergify-chrome-${VERSION}.zip"
curl \
-v \
--fail \
-H "Authorization: Bearer ${GOOGLE_CHROME_WEBSTORE_TOKEN}" \
-H "x-goog-api-version: 2" \
-X PUT \
-T "$name" \
"https://www.googleapis.com/upload/chromewebstore/v1.1/items/${GOOGLE_CHROME_WEBSTORE_APP_ID}"
curl -v \
--fail \
-H "Authorization: Bearer $GOOGLE_CHROME_WEBSTORE_TOKEN" \
-H "x-goog-api-version: 2" \
-H "Content-Length: 0" \
-X POST \
"https://www.googleapis.com/chromewebstore/v1.1/items/${GOOGLE_CHROME_WEBSTORE_APP_ID}/publish"