Skip to content

Update README.md

Update README.md #23

Workflow file for this run

# Build, Sign, and Release Firefox Extension
name: Build, Sign, and Release Firefox Extension
on:
push:
branches:
- main
permissions:
contents: write
jobs:
check-manifest:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check if manifest.json has changed
id: check-manifest
run: |
CHANGED_FILES=$(git diff --name-only HEAD^ HEAD)
if ! echo "$CHANGED_FILES" | grep -q "manifest.json"; then
echo "manifest.json has not changed"
echo "::set-output name=manifest_changed::false"
else
echo "manifest.json has changed"
echo "::set-output name=manifest_changed::true"
fi
outputs:
manifest_changed: ${{ steps.check-manifest.outputs.manifest_changed }}
build-and-release:
needs: check-manifest
if: ${{ needs.check-manifest.outputs.manifest_changed == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install web-ext
run: npm install --global web-ext
- name: Build and sign the extension
run: web-ext sign --artifacts-dir ./artifacts --api-key ${{ secrets.AMO_JWT_ISSUER }} --api-secret ${{ secrets.AMO_JWT_SECRET }}
env:
WEB_EXT_API_KEY: ${{ secrets.JWT_ISSUER }}
WEB_EXT_API_SECRET: ${{ secrets.JWT_SECRET }}
- name: Find signed XPI file name
id: find-xpi
run: echo "::set-output name=xpi_name::$(ls ./artifacts/*.xpi)"
- name: Extract version for tag and release name
id: extract-version
run: |
XPI_NAME="${{ steps.find-xpi.outputs.xpi_name }}"
VERSION_PART=$(echo "$XPI_NAME" | cut -d '-' -f 2)
echo "::set-output name=version::$VERSION_PART"
- name: Copy signed XPI to real name
id: copy-xpi
run: |
cp ${{ steps.find-xpi.outputs.xpi_name }} ./artifacts/quick_abstract.xpi
- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Ignacio de Miguel Díaz"
- name: Create Tag
run: |
VERSION="${{ steps.extract-version.outputs.version }}"
TAG_NAME="v$VERSION"
echo "Creating tag $TAG_NAME"
git config --global user.email "[email protected]"
git config --global user.name "Ignacio de Miguel Díaz"
git tag -a $TAG_NAME -m "Release version $TAG_NAME"
git push origin $TAG_NAME
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload signed XPI as quick_abstract.xpi
uses: softprops/action-gh-release@v2
with:
files: ./artifacts/quick_abstract.xpi
name: quick_abstract-${{ steps.extract-version.outputs.version }}
tag_name: v${{ steps.extract-version.outputs.version }}
draft: false
prerelease: true
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}