Skip to content

Commit 1b135e0

Browse files
ayoung19actions-usergithub-actions[bot]
authored
feat: add automated release workflow (#177)
* Add release workflow * Add version checking script * Lmao * Revert * Test * Test * Woops * Bumps Version to v3.2.1 * Add prettier * Prettified Code! * ??? * Prettified Code! * Bumps Version to v3.3.0 * Add the real release * Delete zip * Bumps Version to v5.0.0 * Woops * woooow * Bumps Version to v6.0.0 * dam * Bumps Version to v7.0.0 * Convert to pr * Correct pr creation * Bumps Version to v8.0.0 * ?? * Bumps Version to v9.0.0 * Bumps Version to v10.0.0 (#4) Co-authored-by: GitHub Action <action@github.com> * Revert * Bumps Version to v12.0.0 * Add token * Bumps Version to v14.0.0 * Change access token name * Set prettier options * Bumps Version to v15.0.0 * Wtf * Bumps Version to v16.0.0 * ? * Bumps Version to v17.0.0 * Test * Bumps Version to v18.0.0 * Wtf * Bumps Version to v19.0.0 * Final * Add suggestions * Remove relative path * Bumps Version to v20.0.0 * Revert "Bumps Version to v20.0.0" This reverts commit d65c5bd. * Try new prettier options * Bumps Version to v21.0.0 * Revert "Bumps Version to v21.0.0" This reverts commit 88ba221. * Revert changes * Bumps Version to v22.0.0 * ??? * Bumps Version to v23.0.0 * lol * Bumps Version to v24.0.0 * Lol * Bumps Version to v25.0.0 * Hm * Bumps Version to v26.0.0 * Wow * Only format changed files * Hardcode version * Bumps Version to v30.0.0 * Bumps Version to v32.0.0 * Undo version update --------- Co-authored-by: ayoung19 <ayoung19@users.noreply.github.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 8fadf4e commit 1b135e0

File tree

6 files changed

+132
-11
lines changed

6 files changed

+132
-11
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Extension Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
runs-on: "ubuntu-latest"
11+
12+
strategy:
13+
matrix:
14+
node-version: [16.x]
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- uses: actions/setup-node@v3
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
23+
- name: Build and compress
24+
run: |
25+
npm install
26+
npm run build
27+
zip -r extension-chrome.zip dist
28+
rm -rf dist
29+
npm run build_ff
30+
zip -r extension-firefox.zip dist
31+
32+
- uses: "marvinpinto/action-automatic-releases@v1.2.1"
33+
with:
34+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
35+
prerelease: false
36+
files: |
37+
extension-chrome.zip
38+
extension-firefox.zip

.github/workflows/upgrade.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Extension Upgrade
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: Version
8+
required: true
9+
10+
jobs:
11+
upgrade:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [16.x]
17+
18+
steps:
19+
- name: Checkout Branch
20+
uses: actions/checkout@v3
21+
with:
22+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
23+
fetch-depth: 0
24+
25+
- uses: actions/setup-node@v3
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
29+
- name: Update manifest/package.json version
30+
run: |
31+
./scripts/version-check.sh
32+
jq '.version = $ENV.VERSION' manifest.json > tmp && mv tmp manifest.json
33+
jq '.version = $ENV.VERSION' package.json > tmp && mv tmp package.json
34+
jq '.version = $ENV.VERSION | .packages."".version = $ENV.VERSION' package-lock.json > tmp && mv tmp package-lock.json
35+
npm install
36+
npx prettier --write manifest.json package.json package-lock.json
37+
env:
38+
VERSION: ${{ inputs.version }}
39+
40+
- name: Add and commit
41+
uses: EndBug/add-and-commit@v9
42+
with:
43+
message: "Bumps Version to v${{ inputs.version }}"
44+
tag: "v${{ inputs.version }}"
45+
46+
- name: Push changes
47+
uses: ad-m/github-push-action@v0.6.0
48+
with:
49+
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
50+
branch: ${{ github.ref }}

.lintignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@ node_modules/
22
dist/
33
webpack.config.js
44
.idea/
5-
package.json
6-
package-lock.json

package-lock.json

Lines changed: 16 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/version-check.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
CURRENT_VERSION=$(jq '.version' manifest.json | tr -d '"')
2+
NEW_VERSION="$VERSION"
3+
4+
if ! echo "$CURRENT_VERSION" | grep -Eq '^[0-9]+.[0-9]+.[0-9]+$'; then
5+
echo Error: Current version not in valid format
6+
exit 1
7+
fi
8+
9+
if ! echo "$NEW_VERSION" | grep -Eq '^[0-9]+.[0-9]+.[0-9]+$'; then
10+
echo Error: New version not in valid format
11+
exit 1
12+
fi
13+
14+
IFS='.' read -ra CURR <<< "$CURRENT_VERSION"
15+
IFS='.' read -ra NEW <<< "$NEW_VERSION"
16+
17+
for i in ${!NEW[*]}; do
18+
if [ $((NEW[i])) -lt $((CURR[i])) ]; then
19+
echo ERROR: New release version is less than current release version
20+
exit 1
21+
elif [ $((NEW[i])) -gt $((CURR[i])) ]; then
22+
exit 0
23+
fi
24+
done
25+
26+
echo Error: Current and new version are equal
27+
exit 1

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = (env) => {
4141
getPathEntries('./src/lib/page_scripts/*.ts'),
4242
getPathEntries('./src/lib/types/*.d.ts'),
4343
getPathEntries('./src/background.ts'),
44-
getPathEntries('./src/**/*.js')
44+
getPathEntries('./src/**/*.js'),
4545
),
4646
output: {
4747
path: path.join(__dirname, 'dist'),

0 commit comments

Comments
 (0)