-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (116 loc) · 4.36 KB
/
Copy pathbuild.yml
File metadata and controls
141 lines (116 loc) · 4.36 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
name: Build and Release
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write
jobs:
test:
name: Test (unit, integration, e2e)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run static analysis (code smells & SAST lint)
run: npm run lint
- name: Run unit and integration tests
run: npm test
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Run E2E tests
run: npm run test:e2e
build:
name: Build extension (.xpi)
needs: test
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
xpi_name: ${{ steps.meta.outputs.xpi_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract version from manifest
id: meta
run: |
VERSION=$(python3 -c "import json,sys; print(json.load(open('src/manifest.json'))['version'])")
XPI_NAME="thunderbird-slack-provider-${VERSION}.xpi"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "xpi_name=${XPI_NAME}" >> "$GITHUB_OUTPUT"
echo "Extension version: ${VERSION}"
- name: Validate manifest
run: |
python3 -c "
import json, sys
with open('src/manifest.json') as f:
m = json.load(f)
required = ['manifest_version','name','version','background']
missing = [k for k in required if k not in m]
if missing:
sys.exit(f'Missing required manifest keys: {missing}')
print('Manifest OK — name:', m['name'], '| version:', m['version'])
"
- name: Package extension
run: |
mkdir -p dist
cd src
zip -r "../dist/${{ steps.meta.outputs.xpi_name }}" . \
--exclude "*.DS_Store" \
--exclude "__MACOSX/*"
echo "Built: dist/${{ steps.meta.outputs.xpi_name }}"
ls -lh "../dist/${{ steps.meta.outputs.xpi_name }}"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: thunderbird-slack-provider-${{ steps.meta.outputs.version }}
path: dist/${{ steps.meta.outputs.xpi_name }}
if-no-files-found: error
release:
name: Publish GitHub Release
needs: build
# Only run on pushes to main (not on PRs)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: thunderbird-slack-provider-${{ needs.build.outputs.version }}
path: dist/
- name: Delete existing release/tag (if any)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="v${{ needs.build.outputs.version }}"
# Delete release if it exists (ignore errors)
gh release delete "$TAG" --yes 2>/dev/null || true
# Delete tag if it exists
git push origin --delete "$TAG" 2>/dev/null || true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.build.outputs.version }}
name: "Thunderbird Slack Provider v${{ needs.build.outputs.version }}"
body: |
## Thunderbird Slack Provider v${{ needs.build.outputs.version }}
### Installation
1. Download the `.xpi` file attached to this release.
2. In Thunderbird, open **Tools → Add-ons and Themes**.
3. Click the ⚙️ gear icon and choose **Install Add-on From File…**.
4. Select the downloaded `.xpi` file.
5. After installation, open the extension settings and enter your Slack API token.
See the [README](https://github.com/${{ github.repository }}#readme) for full instructions including how to create a Slack app and obtain an API token.
files: dist/${{ needs.build.outputs.xpi_name }}
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}