Build and release extension #5
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 extension | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version number for this release' | |
required: true | |
previous_version: | |
description: 'Previous Version' | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Update versions | |
id: update-versions | |
run: | | |
sed -i "s/${{ github.event.inputs.previous_version }}/${{ github.event.inputs.version }}/g" manifest.chrome.json | |
sed -i "s/${{ github.event.inputs.previous_version }}/${{ github.event.inputs.version }}/g" manifest.firefox.json | |
- name: Build Chrome and Firefox release | |
run: npm run build | |
- name: Create Chrome ZIP | |
run: | | |
cd dist/chrome | |
zip -r ../../workforce-mate-chrome-${{ github.event.inputs.version }}.zip * | |
cd ../.. | |
- name: Create Firefox ZIP | |
run: | | |
cd dist/firefox | |
zip -r ../../workforce-mate-firefox-${{ github.event.inputs.version }}.zip * | |
cd ../.. | |
- name: Commit changes | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git add manifest.chrome.json manifest.firefox.json | |
git commit -m "Update version to ${{ github.event.inputs.version }}" | |
git push | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.version }} | |
name: Workforce Mate v${{ github.event.inputs.version }} | |
body_path: ./changelog.md | |
files: | | |
workforce-mate-chrome-${{ github.event.inputs.version }}.zip | |
workforce-mate-firefox-${{ github.event.inputs.version }}.zip |