Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 43e5e17
Author: marcustyphoon <[email protected]>
Date:   Sun Dec 1 17:24:57 2024 -0800

    Fix gh-pages workflow (master branch) (new-xkit#2170)

commit bb16651
Author: marcustyphoon <[email protected]>
Date:   Sun Dec 1 13:15:26 2024 -0800

    Move 7.9.2 patches into 7.10.0 xkit.js (new-xkit#2165)

commit ee9ab3e
Author: marcustyphoon <[email protected]>
Date:   Sat Nov 23 20:58:57 2024 -0800

    Release action: fix XPI download step (new-xkit#2164)

commit d2e56bc
Author: marcustyphoon <[email protected]>
Date:   Fri Nov 22 11:45:25 2024 -0800

    Add release actions (new-xkit#2155)

commit a305a37
Author: marcustyphoon <[email protected]>
Date:   Fri Nov 22 11:20:28 2024 -0800

    7.10.0 xkit patches version bump (new-xkit#2161)

commit 900076f
Author: marcustyphoon <[email protected]>
Date:   Fri Nov 22 10:24:11 2024 -0800

    Add 7.9.2 deployment workflow (new-xkit#2159)

commit a1e6fd6
Author: marcustyphoon <[email protected]>
Date:   Sun Nov 17 10:11:02 2024 -0800

    Update CI action (new-xkit#2156)

commit 9d175f6
Author: marcustyphoon <[email protected]>
Date:   Sun Nov 17 10:10:41 2024 -0800

    Add release metadata action (new-xkit#2153)

commit 3d5f273
Author: marcustyphoon <[email protected]>
Date:   Sun Nov 17 10:09:42 2024 -0800

    Clean up more whitespace (new-xkit#2152)

commit d4a8db0
Merge: da64504 965f1c9
Author: marcustyphoon <[email protected]>
Date:   Sat Nov 16 11:45:29 2024 -0800

    Package code with extension (new-xkit#2148)

commit 965f1c9
Author: Marcus <[email protected]>
Date:   Wed Nov 13 17:06:31 2024 -0800

    add npm cache to action

commit cc385e8
Author: Marcus <[email protected]>
Date:   Tue Nov 5 18:03:21 2024 -0800

    don't fetch invalid resources

commit 4568328
Author: Marcus <[email protected]>
Date:   Tue Nov 5 17:01:57 2024 -0800

    Update .eslintrc.yml

commit 0103bc6
Author: Marcus <[email protected]>
Date:   Tue Nov 5 17:01:52 2024 -0800

    commit index build script

commit d574831
Author: Marcus <[email protected]>
Date:   Tue Oct 22 04:52:47 2024 -0700

    add caching to getExtensionData

commit 7d5d32e
Author: Marcus <[email protected]>
Date:   Mon Oct 21 21:36:21 2024 -0700

    don't remove run_order entries (for downgrade compat)

commit adfd409
Author: Marcus <[email protected]>
Date:   Thu Oct 10 14:52:32 2024 -0700

    add back pages workflow

commit 41e82fc
Author: Marcus <[email protected]>
Date:   Thu Oct 10 15:25:17 2024 -0700

    bump script versions

commit b3fe374
Author: Marcus <[email protected]>
Date:   Wed Oct 9 21:18:56 2024 -0700

    bump version

commit 9bede3b
Author: Marcus <[email protected]>
Date:   Thu Oct 10 01:36:22 2024 -0700

    check updates immediately

commit e7f81db
Author: Marcus <[email protected]>
Date:   Wed Oct 9 21:56:51 2024 -0700

    remove gulp server

commit 48a8a83
Author: Marcus <[email protected]>
Date:   Wed Oct 9 21:17:19 2024 -0700

    remove github pages extension hosting

commit d614d0b
Author: Marcus <[email protected]>
Date:   Thu Oct 10 01:18:59 2024 -0700

    commit index files

commit cb46cba
Author: Marcus <[email protected]>
Date:   Wed Oct 9 21:26:03 2024 -0700

    update eslint globals

commit 66e93e2
Author: Marcus <[email protected]>
Date:   Mon Oct 7 18:47:49 2024 -0700

    remove unused patches

commit 396640f
Author: Marcus <[email protected]>
Date:   Mon Oct 7 18:13:04 2024 -0700

    remove direct eval
  • Loading branch information
marcustyphoon committed Dec 2, 2024
1 parent da64504 commit 4256c25
Show file tree
Hide file tree
Showing 43 changed files with 8,437 additions and 18,926 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
WEB_EXT_API_KEY=
WEB_EXT_API_SECRET=
6 changes: 6 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
root: true
parserOptions:
ecmaVersion: 2018
env:
es6: true
browser: true
jquery: true
webextensions: true
extends: eslint:recommended
rules:
dot-notation: [error, allowPattern: "^[A-Z]"]
Expand Down Expand Up @@ -43,6 +45,10 @@
after: true
no-useless-escape: off
no-prototype-builtins: off
overrides:
- files: "*.mjs"
parserOptions:
sourceType: module
globals:
BigInt: readonly
_: readonly
Expand Down
27 changes: 15 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
42 changes: 42 additions & 0 deletions .github/workflows/gh-pages-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Update gh-pages

on:
push:
branches:
- 'master'
paths:
- 'Extensions/dist/*'
workflow_dispatch:

permissions:
contents: write

jobs:
build:
name: Update gh-pages
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: Install dependencies
run: npm ci

- name: Update 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/"
--message 'Update Extensions/dist/'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 21 additions & 25 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,30 @@
name: Rebuild Distribution
name: Rebuild Distribution (7.9.2)

on:
push:
branches:
- 'master'
- '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@v2
with:
fetch-depth: 0
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v2.1.2
uses: actions/setup-node@v4
with:
node-version: 14

- name: Configure git
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Fetch and reset gh-pages
run: |
git remote set-branches --add origin gh-pages
git fetch
git checkout -f -t -b gh-pages origin/gh-pages
git reset --hard master
cache: npm

- name: Install dependencies
run: npm ci
Expand All @@ -47,10 +38,15 @@ jobs:
- name: Build distribution
run: gulp build

- name: Commit changes
run: |
git add --force Extensions/
git commit -m 'Rebuild Distribution'
- name: Force-push to gh-pages
run: git push -f
- 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 }}
71 changes: 71 additions & 0 deletions .github/workflows/release-after-signing.yml
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
72 changes: 72 additions & 0 deletions .github/workflows/release.yml
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
37 changes: 37 additions & 0 deletions .github/workflows/update-release-metadata.yml
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.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ web-ext-artifacts/

*.iml
.idea/

.env
Loading

0 comments on commit 4256c25

Please sign in to comment.