Build and Release Action #8
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: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- target: chrome | |
build_dir: build/prod/chrome/extension.zip | |
- target: firefox | |
build_dir: build/prod/firefox/whatsapp-web-mod.zip | |
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: "v(.*)" | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- 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 artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: vf-wpp-mod.${{ matrix.target }}.zip | |
path: ${{ matrix.build_dir }} | |
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: "v(.*)" | |
- name: Download artifacts | |
uses: actions/download-artifact@master | |
with: | |
path: artifacts | |
- name: Prepare artifacts # Rename all artifacts to their parent directory name | |
run: | | |
find artifacts -type f -name "*.zip" -printf "/%P\n" | while read FILE; do \ | |
DIR=$(dirname "$FILE" ) | |
mv ./artifacts"$FILE" ./artifacts"$DIR""$DIR" | |
done | |
- name: Build RELEASE_final.md | |
run: envsubst < RELEASE.md > RELEASE_final.md | |
env: | |
VERSION: ${{ steps.tagName.outputs.tag }} | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "artifacts/**/*.zip" | |
tag: v${{ steps.tagName.outputs.tag }} | |
name: Release ${{ steps.tagName.outputs.tag }} | |
bodyFile: RELEASE_final.md | |
token: ${{ secrets.GITHUB_TOKEN }} |