Skip to content

Manifest v3 compatibility #176

Manifest v3 compatibility

Manifest v3 compatibility #176

name: Build release
on:
push:
tags:
- "v*.*.*"
pull_request:
branches:
- main
jobs:
build-extension:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- firefox-desktop
- chromium
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '17.x'
- name: Write version number
if: startsWith(github.ref, 'refs/tags/v')
run: bash .github/deploy-tag.sh
- name: Install dependencies
run: npm install
- name: Build
run: npm run build -- --env=target=${{matrix.target}}
- name: Upload extension artifact
uses: actions/upload-artifact@v3
with:
name: translatelocally-${{matrix.target}}
if-no-files-found: error
path: ${{github.workspace}}/extension/web-ext-artifacts/translatelocally-${{matrix.target}}.zip
upload-prerelease:
if: github.ref == 'refs/heads/main'
needs: build-extension
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifacts@v3
- name: Update development prerelease
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: development-latest
prerelease: true
title: "Latest Development Build"
files: |
./translatelocally-*/translatelocally-*.zip
publish-firefox:
if: startsWith(github.ref, 'refs/tags/v')
needs: build-extension
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '17.x'
- name: Download artifacts
uses: actions/download-artifacts@v3
with:
name: translatelocally-firefox-desktop
- name: Unpack extension
run: unzip -d extension ./translatelocally-firefox-desktop.zip
- name: Sign & publish extension
env:
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }}
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }}
run: |
npx web-ext sign -s extension --no-config-discovery --channel listed
- name: Create release
id: create_release
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }} for Firefox
draft: false
prerelease: false
- name: Upload release
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: web-ext-artifacts/translatelocally.xpi
asset_name: translatelocally.xpi
asset_content_type: application/zip
publish-chrome:
if: startsWith(github.ref, 'refs/tags/v')
needs: build-extension
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifacts@v3
with:
name: translatelocally-chromium
- name: Publish extension
uses: mnao305/[email protected]
with:
file-path: translatelocally-chromium.zip
extension-id: fenadanhohmncaemmgiklcpkeooflaeg
client-id: ${{ secrets.CLIENT_ID }}
client-secret: ${{ secrets.CLIENT_SECRET }}
refresh-token: ${{ secrets.REFRESH_TOKEN }}