forked from Tylian/XKit
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into ocp-apifetch
- Loading branch information
Showing
27 changed files
with
5,533 additions
and
4,668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
WEB_EXT_API_KEY= | ||
WEB_EXT_API_SECRET= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,25 +2,28 @@ name: CI | |
|
||
on: | ||
push: | ||
branches: [ master ] | ||
branches: | ||
- master | ||
pull_request: | ||
branches: [ master ] | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 14 | ||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run tests | ||
run: npm test | ||
- name: Run tests | ||
run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,11 @@ on: | |
branches: | ||
- 'master' | ||
paths: | ||
- 'Extensions/dist/' | ||
- 'Extensions/dist/*' | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
|
@@ -25,4 +29,14 @@ jobs: | |
run: npm ci | ||
|
||
- name: Update gh-pages | ||
run: npx gh-pages --add --dist . --src "Extensions/dist/" | ||
run: > | ||
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | ||
npx gh-pages | ||
-u "github-actions-bot <[email protected]>" | ||
--add | ||
--dist . | ||
--src "Extensions/dist/" | ||
--message 'Update Extensions/dist/' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Rebuild Distribution (7.9.2) | ||
|
||
on: | ||
push: | ||
branches: | ||
- '7.9.2' | ||
paths: | ||
- 'Extensions/*' | ||
- 'Themes/*' | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
name: Autobuild extensions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 14 | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run tests | ||
run: npm test | ||
|
||
- name: Install gulp-cli | ||
run: npm install gulp-cli | ||
|
||
- name: Build distribution | ||
run: gulp build | ||
|
||
- name: Push changes to gh-pages | ||
run: > | ||
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | ||
npx gh-pages | ||
-u "github-actions-bot <[email protected]>" | ||
--add | ||
--dist . | ||
--src "{Extensions/dist/*.json,Extensions/dist/page/gallery.json,Extensions/dist/page/list.json,Extensions/dist/page/themes.json}" | ||
--message 'Rebuild Distribution' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Generate Release (after signing) | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
name: Generate Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
- run: npm ci | ||
|
||
### NOTE: This workflow continues the "Generate Release" workflow if it timed out. | ||
|
||
- name: Firefox — Download Latest Signed XPI | ||
run: node dev/download_signed_xpi.mjs | ||
env: | ||
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }} | ||
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }} | ||
|
||
- name: Get Release Version | ||
uses: actions/github-script@v7 | ||
id: get-version | ||
with: | ||
result-encoding: string | ||
script: | | ||
const fs = require('node:fs'); | ||
const { version } = JSON.parse(fs.readFileSync(('${{ github.workspace }}/manifest.json'))); | ||
const files = fs | ||
.readdirSync('${{ github.workspace }}/web-ext-artifacts') | ||
.filter(filePath => filePath.endsWith(`${version}.xpi`)); | ||
if (files.length === 0) { | ||
throw new Error(`Could not find signed v${version} XPI! Has Mozilla reviewed it?`); | ||
} | ||
const releases = await github.paginate(github.rest.repos.listReleases, { owner: context.repo.owner, repo: context.repo.repo, }); | ||
if (releases.some(({ tag_name }) => tag_name === `v${version}`)) { | ||
throw new Error(`Release v${version} already exists! Did you forget to bump the manifest.json version?`); | ||
} | ||
return version; | ||
# - name: Chrome — Build | ||
# run: npm run build | ||
# - name: Chrome — Upload and Publish | ||
# run: npx chrome-webstore-upload --source=web-ext-artifacts/new_xkit-${{ steps.get-version.outputs.result }}.zip | ||
# env: | ||
# EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }} | ||
# CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }} | ||
# CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }} | ||
# REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }} | ||
|
||
- name: Create Github release draft | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
name: New XKit ${{ steps.get-version.outputs.result }} | ||
tag_name: v${{ steps.get-version.outputs.result }} | ||
body: | | ||
<!-- --> | ||
**NOTE:** Firefox may complain about getting a connection error when clicking the below XPI link. If it does, right-click the link and select "Save Link As...", then navigate to `about:addons` and drag the file onto that screen to install New XKit. | ||
For Chrome: Install from the [Chrome Web Store](https://new-xkit-extension.tumblr.com/chrome) instead of here. | ||
files: web-ext-artifacts/*.xpi | ||
draft: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Generate Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
sign-and-release: | ||
name: Sign and Generate Release | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
- run: npm ci | ||
|
||
- name: Lint WebExtension | ||
run: npm run lint | ||
|
||
- name: Get Release Version | ||
uses: actions/github-script@v7 | ||
id: get-version | ||
with: | ||
result-encoding: string | ||
script: | | ||
const fs = require('node:fs'); | ||
const { version } = JSON.parse(fs.readFileSync(('${{ github.workspace }}/manifest.json'))); | ||
const releases = await github.paginate(github.rest.repos.listReleases, { owner: context.repo.owner, repo: context.repo.repo, }); | ||
if (releases.some(({ tag_name }) => tag_name === `v${version}`)) { | ||
throw new Error(`Release v${version} already exists! Did you forget to bump the manifest.json version?`); | ||
} | ||
return version; | ||
- name: Firefox — Build and Sign | ||
run: npm run sign | ||
timeout-minutes: 30 | ||
env: | ||
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }} | ||
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }} | ||
WEB_EXT_CHANNEL: unlisted | ||
|
||
### NOTE: This workflow may time out here while waiting for Mozilla review. | ||
### If this occurs, run the "Generate Release (after signing)" action once it is complete. | ||
|
||
# - name: Chrome — Build | ||
# run: npm run build | ||
# - name: Chrome — Upload and Publish | ||
# run: npx chrome-webstore-upload --source=web-ext-artifacts/new_xkit-${{ steps.get-version.outputs.result }}.zip | ||
# env: | ||
# EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }} | ||
# CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }} | ||
# CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }} | ||
# REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }} | ||
|
||
- name: Create Github release draft | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
name: New XKit ${{ steps.get-version.outputs.result }} | ||
tag_name: v${{ steps.get-version.outputs.result }} | ||
body: | | ||
<!-- --> | ||
**NOTE:** Firefox may complain about getting a connection error when clicking the below XPI link. If it does, right-click the link and select "Save Link As...", then navigate to `about:addons` and drag the file onto that screen to install New XKit. | ||
For Chrome: Install from the [Chrome Web Store](https://new-xkit-extension.tumblr.com/chrome) instead of here. | ||
files: web-ext-artifacts/*.xpi | ||
draft: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Update Release Metadata | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
newVersion: | ||
description: version override | ||
type: string | ||
required: false | ||
|
||
jobs: | ||
create-update-pr: | ||
name: Create update PR | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
|
||
- name: Update release metadata | ||
run: node dev/update_release_metadata.mjs ${{ inputs.newVersion || '' }} | ||
|
||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
title: Update release metadata | ||
commit-message: update release metadata | ||
branch: update-release-metadata | ||
body: | | ||
Updates the extension version in metadata files, triggering Firefox autoupdate and the "Please update XKit!" in-extension notification. | ||
Remember to confirm that the referenced version is released on Github, the .xpi file link works, and the Chrome web store has the referenced version available before merging this. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ web-ext-artifacts/ | |
|
||
*.iml | ||
.idea/ | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.