forked from PhilipFlyvholm/learnit-plus-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (68 loc) · 2.59 KB
/
submit.yml
File metadata and controls
78 lines (68 loc) · 2.59 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
name: "Submit to Web Store"
on:
workflow_dispatch:
permissions:
contents: write # required for pushing tags & creating releases
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: oven-sh/setup-bun@v2
- name: Build and package the extension into a zip artifact
run: |
bun install --frozen-lockfile
bun package:chrome
bun package:firefox
env:
FIREFOX_EXT_ID: ${{ secrets.FIREFOX_EXT_ID }}
- name: Zip source files for firefox
run: |
$dirs = Get-ChildItem * -Directory | ? { $_.BaseName -in "src", "assets" }
$files = Get-ChildItem . -File
$destination = "build/source.zip"
# compress
Compress-Archive -Path ($files+$dirs) -DestinationPath $destination -CompressionLevel Fastest
if (-not (Test-Path $destination)) { Write-Error "$destination not found"; exit 0 }
- name: Browser Platform Publish
id: publish
uses: PlasmoHQ/bpp@v3.8.0
with:
keys: ${{ secrets.SUBMIT_KEYS }}
chrome-file: build/chrome-mv3-prod.zip
firefox-file: build/firefox-mv3-prod.zip
source: build/source.zip
- name: Extract version from package.json
id: get_version
shell: pwsh
run: |
$version = (Get-Content package.json | ConvertFrom-Json).version
if (-not $version) { Write-Error 'Version not found in package.json'; exit 1 }
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Create tag for version (if missing)
if: steps.publish.outcome == 'success'
shell: pwsh
run: |
$version='${{ steps.get_version.outputs.version }}'
$tag="v$version"
git config user.name 'github-actions'
git config user.email 'github-actions@github.com'
git fetch --tags --quiet
git rev-parse --verify --quiet $tag
if ($LASTEXITCODE -eq 0) {
Write-Host "Tag $tag already exists. Skipping tag creation."
} else {
git tag $tag
git push origin $tag
Write-Host "Created and pushed tag $tag"
}
- name: Create GitHub Release & upload artifacts
if: steps.publish.outcome == 'success'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.get_version.outputs.version }}
name: v${{ steps.get_version.outputs.version }}
files: |
build/chrome-mv3-prod.zip
build/firefox-mv3-prod.zip
generate_release_notes: true