Skip to content

Commit

Permalink
Github Actions: Add auto-updating release flow
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiodekker committed Feb 6, 2024
1 parent c084fac commit d976e20
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 3 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Release new version

on:
workflow_dispatch:
inputs:
type:
type: choice
description: Please select the type of release
options:
- patch
- minor
- major

jobs:
release:
name: Release new version
runs-on: macos-12

permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm ci
- name: Bump version
id: version
run: |
set -e
version=$(npm version ${{ github.event.inputs.type }} --no-git-tag-version)
echo "Version set to $version"
echo "version=$version" >> $GITHUB_OUTPUT
sed -i '' "s/0\.0\.0/${version#v}/g" public/manifest.json
sed -i '' "s/version='[0-9.]*' status='ok'/version='${version#v}' status='ok'/" updates.xml
git --no-pager diff public/manifest.json updates.xml
- name: Setup Chromium
run: |
wget --no-verbose -O ungoogled-chromium.dmg https://github.com/claudiodekker/ungoogled-chromium-macos/releases/download/121.0.6167.139-1.1/ungoogled-chromium_121.0.6167.139-1.1_x86-64-macos-signed.dmg
hdiutil attach ungoogled-chromium.dmg
- name: Build extension
run: npm run build
- name: Package extension
env:
PACKAGING_PRIVATE_KEY: ${{ secrets.PACKAGING_PRIVATE_KEY }}
run: |
echo $PACKAGING_PRIVATE_KEY | base64 --decode > /tmp/key.pem
/Volumes/Chromium/Chromium.app/Contents/MacOS/Chromium --pack-extension=dist --pack-extension-key=/tmp/key.pem
mv dist.crx chromium-update-notifier.crx
- name: Prepare release text
run: |
echo "## ${{ steps.version.outputs.version }}" > github_release_text.md
echo "" >> github_release_text.md
echo "For more information, see the [CHANGELOG.md](https://github.com/claudiodekker/chromium-update-notifier/blob/master/CHANGELOG.md) file." >> github_release_text.md
- name: Create release
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.version.outputs.version }}
tag_name: ${{ steps.version.outputs.version }}
body_path: github_release_text.md
draft: false
prerelease: false
fail_on_unmatched_files: true
files: chromium-update-notifier.crx
- name: Commit version bump
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: master
commit_message: "Bump version to ${{ steps.version.outputs.version }}"
file_pattern: package.json package-lock.json updates.xml
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ If you're maintaining a repository and would like to be added to the list, pleas
By default, the extension is configured to detect your OS and architecture, and only filter releases relevant to it.
You can change this in the settings page of the extension (rightclick the icon and click "Options").

### Q: How do I update this extension?
### Q: How do I update this extension, or make sure it's auto-updated?

You can manually update the extension from time to time by following the installation instructions again.
The recommended approach would be to use [NeverDecaf/chromium-web-store](https://github.com/NeverDecaf/chromium-web-store), as it will automatically check for updates and notify you when one is available.

Alternatively, you can manually update the extension from time to time by following the installation instructions again.

## Changelog

Expand Down
3 changes: 2 additions & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
"page": "options.html",
"open_in_tab": true
},
"update_url": "https://raw.githubusercontent.com/claudiodekker/chromium-update-notifier/master/updates.xml",
"permissions": [
"alarms",
"downloads",
"storage"
],
"version": "1.0.0"
"version": "0.0.0"
}
6 changes: 6 additions & 0 deletions updates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='fjnohikfgoehgiklnkakifmpioaniife'>
<updatecheck codebase='https://github.com/claudiodekker/chromium-update-notifier/releases/latest/download/chromium-update-notifier.crx' version='0.0.0' status='ok' />
</app>
</gupdate>

0 comments on commit d976e20

Please sign in to comment.