0.0.7 #19
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' | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
env: | |
SRC_DIR: src | |
jobs: | |
build: | |
name: 'Build' | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
outputs: | |
version: ${{ steps.manifest.outputs.version }} | |
package_name: ${{ steps.manifest.outputs.package_name }} | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v3 | |
- name: 'Parse Manifest' | |
id: manifest | |
run: | | |
echo "version=$(jq '.version' < manifest.json | tr -d '"')" >> "$GITHUB_OUTPUT" | |
export name="$(jq '.name' < manifest.json | tr -d '"' | tr '[:upper:]' '[:lower:]')" | |
echo "package_name=${name// /_}" >> "$GITHUB_OUTPUT" | |
- name: 'Release Version Check' | |
if: ${{ github.event_name == 'release' }} | |
run: | | |
echo ${{ github.ref_name }} | |
echo ${{ steps.manifest.outputs.version }} | |
if [ "${{ github.ref_name }}" != "${{ steps.manifest.outputs.version }}" ];then | |
echo "Manifest Version ${version} does not match release tag ${{ github.ref_name }}" | |
exit 1 | |
fi | |
- name: 'Setup Node' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: 'Build All' | |
run: | | |
npm install | |
npm run build | |
- name: 'Debug' | |
run: ls -l web-ext-artifacts | |
- name: 'Upload to Actions' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts | |
path: web-ext-artifacts/ | |
- name: 'Upload to Release' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: web-ext-artifacts/* | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true | |
publish: | |
name: 'Publish' | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
needs: [build] | |
if: ${{ github.event_name == 'release' }} | |
steps: | |
- name: 'Download Artifacts' | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifacts | |
- name: 'Sign Mozilla Addon' | |
run: | | |
unzip *firefox* -d src | |
npx web-ext sign --api-key="${{ secrets.FIREFOX_API_KEY }}" \ | |
--api-secret="${{ secrets.FIREFOX_API_SECRET }}" \ | |
--source-dir "src" | |
- name: 'Rename Signed Artifact' | |
working-directory: web-ext-artifacts | |
run: | | |
ls -l . | |
mv *.xpi "${{ needs.build.outputs.package_name }}-firefox.xpi" | |
ls -l . | |
- name: 'Upload to Actions' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: signed | |
path: web-ext-artifacts/ | |
- name: 'Upload to Release' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: web-ext-artifacts/* | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true | |
# | |
# update: | |
# name: 'Update Manifest' | |
# runs-on: ubuntu-latest | |
# timeout-minutes: 30 | |
# needs: [build, publish] | |
# if: ${{ github.event_name == 'release' }} | |
# | |
# steps: | |
# - name: 'Checkout' | |
# uses: actions/checkout@v3 |