Merge pull request #6 from vanflux/feat/better-crypto-ui #23
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |