-
Notifications
You must be signed in to change notification settings - Fork 79
90 lines (75 loc) · 3.17 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
name: REL
on:
push:
branches: [master]
pull_request:
jobs:
manifest:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: extract
working-directory: ./workspace/extension/static
run: echo "version=$(jq -r '.version' manifest.json)" >> $GITHUB_OUTPUT
bundle:
runs-on: ubuntu-latest
needs: manifest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install
- working-directory: ./workspace/extension
run: pnpm build && cd build && zip -r svelte-devtools *
- uses: actions/upload-artifact@v4
with:
name: extension-${{ github.sha }}
path: workspace/extension/build/svelte-devtools.zip
- if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
WORKFLOW: ${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts
run: |
url=https://github.com/$WORKFLOW/$(gh api repos/$WORKFLOW --jq '.artifacts[0].id')
commented=$(gh pr view $PR_NUMBER --json comments --jq '.comments[].author.login | select(. | contains("github-actions"))')
body="Try the changes in this PR by [side-loading the built extension]($url). :rocket:"
if [ -z "$commented" ]; then
gh pr comment $PR_NUMBER --body "$body"
else
gh pr comment $PR_NUMBER --edit-last --body "$body"
fi
publish:
runs-on: ubuntu-latest
needs: [manifest, bundle]
if: |
github.repository == 'sveltejs/svelte-devtools' &&
github.event_name == 'push' && github.ref == 'refs/heads/master' &&
startsWith(github.event.head_commit.message, format('~ v{0}', needs.manifest.outputs.version))
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/download-artifact@v4
- working-directory: extension-${{ github.sha }}
run: |
pnpm dlx web-ext sign --channel unlisted \
--api-key ${{ secrets.WEB_EXT_API_KEY }} \
--api-secret ${{ secrets.WEB_EXT_API_SECRET }}
- working-directory: extension-${{ github.sha }}
env:
GH_TOKEN: ${{ github.token }}
run: | # https://cli.github.com/manual/gh_release_create
gh release create v${{ needs.manifest.outputs.version }} \
svelte-devtools.zip web-ext-artifacts/*.xpi#svelte-devtools.xpi \
--title ${{ needs.manifest.outputs.version }} \
--draft --generate-notes --notes '
Built from ${{ github.event.head_commit.id }} at https://github.com/sveltejs/svelte-devtools/actions/runs/${{ github.run_id }}
- Chrome Web Store: https://chrome.google.com/webstore/detail/svelte-devtools/kfidecgcdjjfpeckbblhmfkhmlgecoff
- Firefox Signed Add-on: https://github.com/sveltejs/svelte-devtools/releases/download/v${{ needs.manifest.outputs.version }}/svelte-devtools.xpi
---'
# TODO: publish to Chrome Web Store