-
Notifications
You must be signed in to change notification settings - Fork 4
98 lines (78 loc) · 3 KB
/
release.yml
File metadata and controls
98 lines (78 loc) · 3 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
name: Release Build
on:
push:
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get tag version
id: tag
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Extract latest changelog
id: changelog
run: |
# Extract the first changelog entry (between first ## and second ##)
CHANGELOG=$(awk '/^## / {if (++count == 2) exit; if (count == 1) next} count == 1' CHANGELOG.md)
# Save to output (escape for multiline)
echo "BODY<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Build Chrome extension
run: |
# Create temporary build directory
mkdir -p build/chrome
# Copy src contents to build directory
cp -r src/* build/chrome/
# Remove style.scss
rm -f build/chrome/style.scss
# Replace manifest.json with manifest_chrome.json
rm -f build/chrome/manifest.json
cp src/manifest_chrome.json build/chrome/manifest.json
# Remove other manifest files
rm -f build/chrome/manifest_*.json
# Create zip
cd build/chrome
zip -r ../../SubscriptionInfo-Chrome-${{ steps.tag.outputs.VERSION }}.zip .
cd ../..
- name: Build Firefox extension
run: |
# Create temporary build directory
mkdir -p build/firefox
# Copy src contents to build directory
cp -r src/* build/firefox/
# Remove style.scss
rm -f build/firefox/style.scss
# Replace manifest.json with manifest_firefox.json
rm -f build/firefox/manifest.json
cp src/manifest_firefox.json build/firefox/manifest.json
# Remove other manifest files
rm -f build/firefox/manifest_*.json
# Create zip
cd build/firefox
zip -r ../../SubscriptionInfo-Firefox-${{ steps.tag.outputs.VERSION }}.zip .
cd ../..
- name: Upload Chrome artifact
uses: actions/upload-artifact@v4
with:
name: SubscriptionInfo-Chrome-${{ steps.tag.outputs.VERSION }}
path: SubscriptionInfo-Chrome-${{ steps.tag.outputs.VERSION }}.zip
retention-days: 90
- name: Upload Firefox artifact
uses: actions/upload-artifact@v4
with:
name: SubscriptionInfo-Firefox-${{ steps.tag.outputs.VERSION }}
path: SubscriptionInfo-Firefox-${{ steps.tag.outputs.VERSION }}.zip
retention-days: 90
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
SubscriptionInfo-Chrome-${{ steps.tag.outputs.VERSION }}.zip
SubscriptionInfo-Firefox-${{ steps.tag.outputs.VERSION }}.zip
body: ${{ steps.changelog.outputs.BODY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}