Skip to content

Update main.yml

Update main.yml #14

Workflow file for this run

name: Build and Publish
on:
push:
branches: [ main ]
workflow_dispatch:
env:
MAJOR_VER: 1
MINOR_VER: 1
jobs:
build_firefox:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '21.6.2'
- run: npm install --legacy-peer-deps
- run: npm run build -- --env=version=$MAJOR_VER.$MINOR_VER.${{ github.run_number }}
- name: Zip firefox
run: zip -qq -r firefox.zip *
working-directory: dist
- uses: actions/upload-artifact@v4
with:
name: firefox
path: dist/firefox.zip
publish_firefox:
needs: [build_firefox]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Zip source
run: zip -qq -r src.zip *
- name: Download extension
uses: actions/download-artifact@v4
with:
name: firefox
- name: Publish Firefox
uses: maoserr/firefox_extension_publish@v1.0.4
with:
firefox_extension_id: whistleSwicher@7gugu.com
api_key: ${{ secrets.FIREFOX_API_KEY }}
api_secret: ${{ secrets.FIREFOX_API_SECRET }}
file: firefox.zip
src_file: src.zip
publish_release:
needs: [ build_firefox ]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Download extension
uses: actions/download-artifact@v4
- name: Release
uses: opspresso/action-release@v0.2.9
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
TAG_NAME: $MAJOR_VER.$MINOR_VER.${{ github.run_number }}