mirror of
https://github.com/XFox111/PasswordGeneratorExtension.git
synced 2026-04-22 08:08:01 +03:00
Major 3.0: Complete overhaul of the codebase, new features, bugfixes and more (#223)
Complete overhaul for v3.0 (see related PR)
This commit is contained in:
+124
-153
@@ -4,172 +4,143 @@ on:
|
||||
release:
|
||||
types: [ released ]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
targets:
|
||||
description: Targets
|
||||
required: true
|
||||
default: "chrome,firefox"
|
||||
type: string
|
||||
firefox:
|
||||
description: Deploy Firefox
|
||||
type: boolean
|
||||
default: true
|
||||
chrome:
|
||||
description: Deploy Chrome
|
||||
type: boolean
|
||||
default: true
|
||||
edge:
|
||||
description: Deploy Edge
|
||||
type: boolean
|
||||
default: true
|
||||
gh-release:
|
||||
description: Attach to GitHub release
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container: node:20
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: ${{ fromJSON(format('[%s]', github.event.inputs.targets || 'chrome,firefox')) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
|
||||
- run: yarn install
|
||||
- run: yarn lint
|
||||
- run: TARGET=${{ matrix.target }} yarn build
|
||||
|
||||
- name: Drop build artifacts (${{ matrix.target }})
|
||||
uses: actions/upload-artifact@main
|
||||
with:
|
||||
name: ${{ matrix.target }}
|
||||
path: dist
|
||||
|
||||
- name: "web-ext lint"
|
||||
if: ${{ matrix.target == 'firefox' }}
|
||||
uses: kewisch/action-web-ext@cb8a69420fea686e331e270b6581d4d289ecb2d2
|
||||
with:
|
||||
cmd: lint
|
||||
source: dist
|
||||
channel: listed
|
||||
|
||||
- uses: TheDoctor0/zip-release@main
|
||||
with:
|
||||
filename: packed-${{ matrix.target }}.zip
|
||||
path: dist
|
||||
|
||||
- name: Drop packed artifacts (${{ matrix.target }})
|
||||
uses: actions/upload-artifact@main
|
||||
with:
|
||||
name: packed-${{ matrix.target }}
|
||||
path: packed-${{ matrix.target }}.zip
|
||||
|
||||
publish-github:
|
||||
needs: build
|
||||
if: ${{ github.event_name == 'release' || github.event.inputs.gh-release == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: ${{ fromJSON(format('[%s]', github.event.inputs.targets || 'chrome,firefox')) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/download-artifact@main
|
||||
with:
|
||||
name: packed-${{ matrix.target }}
|
||||
|
||||
- name: Attach build to release
|
||||
uses: xresloader/upload-to-github-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
file: PasswordGenerator-${{ matrix.target }}.zip
|
||||
draft: false
|
||||
overwrite: true
|
||||
update_latest_release: true
|
||||
|
||||
publish-chrome:
|
||||
needs: build
|
||||
if: ${{ github.event_name == 'release' || (github.event.inputs.chrome == 'true' && contains(fromJson(format('[%s]', github.event.inputs.targets)), 'chrome')) }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/download-artifact@main
|
||||
with:
|
||||
name: packed-chrome
|
||||
|
||||
- name: Configure manifest
|
||||
uses: Amadevus/pwsh-script@v2
|
||||
with:
|
||||
script: |
|
||||
[PSCustomObject] $package = Get-Content "package.json" | ConvertFrom-Json;
|
||||
- uses: wdzeng/chrome-extension@main
|
||||
with:
|
||||
extension-id: jnjobgjobffgmgfnkpkjfjkkfhfikmfl
|
||||
zip-path: packed-chrome.zip
|
||||
client-id: ${{ secrets.CHROME_CLIENT_ID }}
|
||||
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }}
|
||||
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }}
|
||||
|
||||
[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:
|
||||
needs: Build
|
||||
publish-edge:
|
||||
needs: build
|
||||
if: ${{ github.event_name == 'release' || (github.event.inputs.edge == 'true' && contains(fromJson(format('[%s]', github.event.inputs.targets)), 'chrome')) }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build
|
||||
- uses: actions/download-artifact@main
|
||||
with:
|
||||
name: packed-chrome
|
||||
|
||||
- name: Configure manifest
|
||||
uses: Amadevus/pwsh-script@v2
|
||||
with:
|
||||
script: Remove-Item "manifest.v2.json"
|
||||
- uses: wdzeng/edge-addon@main
|
||||
with:
|
||||
product-id: ${{ secrets.EDGE_PRODUCT_ID }}
|
||||
zip-path: packed-chrome.zip
|
||||
client-id: ${{ secrets.EDGE_CLIENT_ID }}
|
||||
client-secret: ${{ secrets.EDGE_CLIENT_SECRET }}
|
||||
access-token-url: ${{ secrets.EDGE_ACCESS_TOKEN_URL }}
|
||||
|
||||
- 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:
|
||||
needs: Build
|
||||
publish-firefox:
|
||||
needs: build
|
||||
if: ${{ github.event_name == 'release' || (github.event.inputs.firefox == 'true' && contains(fromJson(format('[%s]', github.event.inputs.targets)), 'firefox')) }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build
|
||||
- uses: actions/download-artifact@main
|
||||
with:
|
||||
name: packed-firefox
|
||||
|
||||
- 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:
|
||||
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
|
||||
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:
|
||||
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
|
||||
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:
|
||||
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 }}
|
||||
- uses: wdzeng/firefox-addon@main
|
||||
with:
|
||||
addon-guid: ${{ secrets.FIREFOX_EXT_UUID }}
|
||||
xpi-path: packed-firefox.zip
|
||||
jwt-issuer: ${{ secrets.FIREFOX_API_KEY }}
|
||||
jwt-secret: ${{ secrets.FIREFOX_CLIENT_SECRET }}
|
||||
|
||||
Reference in New Issue
Block a user