-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (84 loc) · 2.75 KB
/
build-release.yml
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
name: Build and Release Action
on:
push:
tags:
- "[a-zA-Z]+[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
strategy:
matrix:
include:
- target: chrome
build_zip_path: build/prod/chrome/extension.zip
page_script_path: build/prod/chrome/raw/page.js
- target: firefox
build_zip_path: build/prod/firefox/whatsapp-web-mod.zip
page_script_path: build/prod/firefox/raw/page.js
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
- uses: olegtarasov/get-tag@v2.1.2
id: tagName
with:
tagRegex: "[a-zA-Z]+(.*)"
- name: Install dependencies
run: npm i
- name: Build for ${{ matrix.target }}
env:
VERSION: ${{ steps.tagName.outputs.tag }}
run: npm run build ${{ matrix.target }}
- name: Upload zip artifact
uses: actions/upload-artifact@master
with:
name: vf-wpp-mod.${{ matrix.target }}.zip
path: ${{ matrix.build_zip_path }}
if-no-files-found: error
- name: Upload page artifact
uses: actions/upload-artifact@master
with:
name: page-${{ matrix.target }}
path: ${{ matrix.page_script_path }}
if-no-files-found: error
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- uses: olegtarasov/get-tag@v2.1.2
id: tagName
with:
tagRegex: "[a-zA-Z]+(.*)"
- name: Download artifacts
uses: actions/download-artifact@master
with:
path: downloaded
- name: Prepare extension artifacts # Rename all artifacts to their parent directory name & build wwm-vf.user.js
run: |
mkdir artifacts
find downloaded -type f -name "*.zip" -printf "/%P\n" | while read FILE; do \
DIR=$(dirname "$FILE" )
mv downloaded"$FILE" artifacts"$DIR"
done
envsubst < tm-base.js > wwm-vf.user.js
cat downloaded/page-chrome/page.js >> wwm-vf.user.js
mv wwm-vf.user.js artifacts/wwm-vf.user.js
env:
VERSION: ${{ steps.tagName.outputs.tag }}
- name: Build RELEASE_final.md
run: envsubst < RELEASE.md > RELEASE_final.md
env:
VERSION: ${{ github.ref_name }}
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "artifacts/*"
tag: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
bodyFile: RELEASE_final.md
token: ${{ secrets.GITHUB_TOKEN }}