-
-
Notifications
You must be signed in to change notification settings - Fork 4
145 lines (140 loc) · 4.98 KB
/
Copy pathci.yml
File metadata and controls
145 lines (140 loc) · 4.98 KB
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
135
136
137
138
139
140
141
142
143
144
145
on:
push:
branches: [master]
tags:
- "v*"
pull_request:
branches: [master]
workflow_dispatch:
inputs:
publish:
description: "Publish to AMO, Chrome Web Store, and GitHub Releases"
type: boolean
default: false
name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: "Test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version: "1.25"
- uses: extractions/setup-just@v4
- name: Check generated Flatpak Go module sources
run: |
scripts/generate-flatpak-go-modules.py
git diff --exit-code -- flatpak/go-modules.json
- name: Test internal packages with coverage
run: just test-coverage
- name: Display coverage summary
run: |
echo "## Test Coverage Summary" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
go tool cover -func=coverage.out >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Upload coverage report
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: coverage.out
build-webextension:
name: "Build WebExtension"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: "lts/*"
- uses: extractions/setup-just@v4
- name: Bundle extension for Firefox and Chrome
run: just bundle-extension
- name: Validate Firefox manifest
run: jq -e '.background.scripts == ["build/background.js"] and (.background.service_worker | not)' firefox-extension/manifest.json
- name: Validate Chrome manifest
run: |
unzip -p switchyard-webextension-chrome.zip manifest.json > /tmp/manifest.chrome.json
jq -e '.background.service_worker == "build/background.js" and (.background.scripts | not) and (.key | not)' /tmp/manifest.chrome.json
- uses: actions/upload-artifact@v7
with:
name: firefox-extension
path: firefox-extension
- uses: actions/upload-artifact@v7
with:
name: chrome-extension
path: switchyard-webextension-chrome.zip
build-flatpak:
name: "Build Flatpak"
runs-on: ubuntu-latest
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-50
options: --privileged
steps:
- uses: actions/checkout@v7
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: io.github.alyraffauf.Switchyard.Devel-${{ github.sha }}-x86_64.flatpak
manifest-path: flatpak/io.github.alyraffauf.Switchyard.Devel.yml
cache-key: flatpak-builder
arch: x86_64
publish-amo:
name: "Publish to AMO"
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.publish)
needs: [build-webextension]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v6
with:
node-version: "lts/*"
- uses: actions/download-artifact@v8
with:
name: firefox-extension
path: firefox-extension
- name: Submit to AMO
run: npx web-ext sign --source-dir=firefox-extension --channel=listed --approval-timeout=0 --api-key=${{ secrets.AMO_JWT_ISSUER }} --api-secret=${{ secrets.AMO_JWT_SECRET }}
publish-cws:
name: "Publish to Chrome Web Store"
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.publish)
needs: [build-webextension]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v6
with:
node-version: "lts/*"
- uses: actions/download-artifact@v8
with:
name: chrome-extension
path: .
- name: Submit to Chrome Web Store
run: npx chrome-webstore-upload-cli@3 upload --source switchyard-webextension-chrome.zip --auto-publish
env:
EXTENSION_ID: ${{ secrets.CWS_EXTENSION_ID }}
CLIENT_ID: ${{ secrets.CWS_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CWS_CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.CWS_REFRESH_TOKEN }}
publish-github:
name: "Publish GitHub Release"
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.publish)
needs: [build-flatpak, test, publish-amo, publish-cws]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Flatpak bundles
uses: actions/download-artifact@v8
with:
pattern: io.github.alyraffauf.Switchyard.Devel-${{ github.sha }}-*.flatpak
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v3
with:
files: |
*.flatpak
draft: false
prerelease: false
generate_release_notes: true
fail_on_unmatched_files: true