1
0
mirror of https://github.com/XFox111/PasswordGeneratorExtension.git synced 2026-04-22 08:08:01 +03:00
Files
PasswordGeneratorExtension/.github/workflows/cd_pipeline.yaml
T
Eugene Fox 3e137f6955 CI workflow fix for Edge and Chrome publishing (#206)
* Updated actions versions for Edge and Chrome publishing

* Added conditions for CI jobs

* Updated workflow

* Possible fix for Chrome CI action
2023-09-05 18:46:20 +03:00

194 lines
5.2 KiB
YAML

name: Release pipeline
on:
release:
types: [ released ]
workflow_dispatch:
inputs:
firefox:
description: Mozilla Firefox
type: boolean
default: true
chrome:
description: Google Chrome
type: boolean
default: true
edge:
description: Microsoft Edge
type: boolean
default: true
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure manifest
uses: Amadevus/pwsh-script@v2
with:
script: |
[PSCustomObject] $package = Get-Content "package.json" | ConvertFrom-Json;
[PSCustomObject] $manifest = Get-Content "public/manifest.json" | ConvertFrom-Json;
$manifest.version = $package.version;
$manifest | ConvertTo-Json -Depth 10 | Out-File "public/manifest.json"
$manifest = Get-Content "public/manifest.v2.json" | ConvertFrom-Json;
$manifest.version = $package.version;
$manifest | ConvertTo-Json -Depth 10 | Out-File "public/manifest.v2.json"
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: yarn
- run: yarn install
- run: yarn build
- name: Drop artifacts (build)
uses: actions/upload-artifact@v3.1.2
with:
name: build
path: build
Pack-Chromium:
if: ${{ github.event_name == 'release' || github.event.inputs.chrome == 'true' || github.event.inputs.edge == 'true' }}
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: build
- name: Configure manifest
uses: Amadevus/pwsh-script@v2
with:
script: Remove-Item "manifest.v2.json"
- name: Pack extension
uses: TheDoctor0/zip-release@0.7.1
with:
filename: PasswordGenerator-Chromium.zip
- name: Drop artifacts (Chromium)
uses: actions/upload-artifact@v3.1.2
with:
name: Chromium
path: PasswordGenerator-Chromium.zip
- name: Attach build to release
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: PasswordGenerator-Chromium.zip
draft: false
update_latest_release: true
Pack-Firefox:
if: ${{ github.event_name == 'release' || github.event.inputs.firefox == 'true' }}
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: build
- name: Configure manifest
uses: Amadevus/pwsh-script@v2
with:
script: |
Remove-Item "manifest.json"
Rename-Item "manifest.v2.json" "manifest.json"
- name: "web-ext lint"
uses: kewisch/action-web-ext@e0ea88d527a8a90bc10d600f80ac667d219e6bf1
with:
cmd: lint
source: .
channel: listed
- name: Pack extension
uses: TheDoctor0/zip-release@0.7.1
with:
filename: PasswordGenerator-Firefox.zip
- name: Drop artifacts (Firefox)
uses: actions/upload-artifact@v3.1.2
with:
name: Firefox
path: PasswordGenerator-Firefox.zip
- name: Attach build to release
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: PasswordGenerator-Firefox.zip
draft: false
update_latest_release: true
Chrome:
if: ${{ github.event_name == 'release' || github.event.inputs.chrome == 'true' }}
needs: Pack-Chromium
runs-on: ubuntu-latest
steps:
- name: Download artifacts (Chromium)
uses: actions/download-artifact@v3
with:
name: Chromium
- name: Publish to Chrome Web Store
uses: wdzeng/chrome-extension@v1.1.1
with:
extension-id: jnjobgjobffgmgfnkpkjfjkkfhfikmfl
zip-path: PasswordGenerator-Chromium.zip
client-id: ${{ secrets.CHROME_CLIENT_ID }}
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }}
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }}
Edge:
if: ${{ github.event_name == 'release' || github.event.inputs.edge == 'true' }}
needs: Pack-Chromium
runs-on: ubuntu-latest
steps:
- name: Download artifacts (Chromium)
uses: actions/download-artifact@v3
with:
name: Chromium
- name: Publish to Edge Addons
uses: wdzeng/edge-addon@v1.1.0
with:
product-id: ${{ secrets.EDGE_PRODUCT_ID }}
zip-path: PasswordGenerator-Chromium.zip
client-id: ${{ secrets.EDGE_CLIENT_ID }}
client-secret: ${{ secrets.EDGE_CLIENT_SECRET }}
access-token-url: ${{ secrets.EDGE_ACCESS_TOKEN_URL }}
Firefox:
if: ${{ github.event_name == 'release' || github.event.inputs.firefox == 'true' }}
needs: Pack-Firefox
runs-on: ubuntu-latest
steps:
- name: Download artifacts (Firefox)
uses: actions/download-artifact@v3
with:
name: Firefox
- name: Publish to Firefox
uses: wdzeng/firefox-addon@v1
with:
addon-guid: ${{ secrets.FIREFOX_EXT_UUID }}
xpi-path: PasswordGenerator-Firefox.zip
jwt-issuer: ${{ secrets.FIREFOX_API_KEY }}
jwt-secret: ${{ secrets.FIREFOX_CLIENT_SECRET }}