Update CI workflows

This commit is contained in:
Federico Brigante 2023-03-02 19:39:28 +08:00
parent 3d7dc9ffa4
commit af688eab03
5 changed files with 431 additions and 1292 deletions

View File

@ -15,7 +15,8 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version-file: .nvmrc
cache: npm
- name: install
run: npm ci || npm install
- name: XO
@ -24,6 +25,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
- name: install
run: npm ci || npm install
- name: build

View File

@ -12,39 +12,39 @@ on:
jobs:
Version:
outputs:
created: ${{ steps.daily-version.outputs.created }}
version: ${{ steps.daily-version.outputs.version }}
created: ${{ env.DAILY_VERSION_CREATED }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 20
- uses: actions/setup-node@v3
with:
node-version: 16
node-version-file: .nvmrc
cache: npm
- name: install
run: npm ci || npm install
- run: npm test
- uses: fregante/daily-version-action@v2
name: Create tag if necessary
id: daily-version
- if: steps.daily-version.outputs.created
name: Create release
- run: npm ci
- name: Test and build
run: npm test
- name: Create tag if necessary
uses: fregante/daily-version-action@v2
- name: Update manifest.json with version ${{ env.DAILY_VERSION}}
if: env.DAILY_VERSION_CREATED
run: npx dot-json@1 "$DIRECTORY/manifest.json" version "$DAILY_VERSION"
- name: Ready for "submit" jobs
if: env.DAILY_VERSION_CREATED
uses: actions/upload-artifact@v3
with:
path: ${{ env.DIRECTORY }}
- name: Create release
if: env.DAILY_VERSION_CREATED
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
cd $DIRECTORY
FILENAME="$PROJECT_NAME-local-install.zip"
zip -r "$FILENAME" *
gh release create "${{ steps.daily-version.outputs.version }}"
--generate-notes "$FILENAME"
working-directory: ${{ env.DIRECTORY }}
run: |
FILENAME="$PROJECT_NAME-$DAILY_VERSION-for-local-testing-only.zip"
zip -r "$FILENAME" ./*
gh release create "$DAILY_VERSION" --generate-notes "$FILENAME"
Submit:
needs: Version
if: github.event_name == 'workflow_dispatch' || needs.Version.outputs.created
if: needs.Version.outputs.created
strategy:
fail-fast: false
matrix:
@ -53,32 +53,20 @@ jobs:
- chrome
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- name: install
run: npm ci || npm install
- run: npm run build --if-present
- name: Update extensions meta
run: >-
npx dot-json@1 $DIRECTORY/manifest.json version ${{
needs.Version.outputs.version }}
- name: Submit
run: |
case ${{ matrix.command }} in
chrome)
cd $DIRECTORY && npx chrome-webstore-upload-cli@2 upload --auto-publish
;;
firefox)
cd $DIRECTORY && npx web-ext-submit@7
;;
esac
- uses: actions/download-artifact@v3
- name: Submit to Mozilla
if: matrix.command == 'firefox'
working-directory: artifact
run: npx web-ext-submit@7
env:
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }}
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }}
- name: Submit to Google
if: matrix.command == 'chrome'
working-directory: artifact
run: npx chrome-webstore-upload-cli@2 upload --auto-publish
env:
EXTENSION_ID: ${{ secrets.EXTENSION_ID }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }}
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }}

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
18

1627
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@
"dependencies": {
"one-event": "^3.0.0",
"webext-base-css": "^1.4.3",
"webext-options-sync": "^4.0.0",
"webext-options-sync": "^4.0.1",
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
@ -38,8 +38,8 @@
"xo": "^0.53.1"
},
"engines": {
"node": ">=15",
"npm": ">=7"
"node": ">=18",
"npm": ">=8"
},
"webExt": {
"sourceDir": "distribution",