Skip to content

Release

Release #101

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*' # Triggers when a version tag is pushed
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # Ensure the token has write access to the repository contents
env:
FILES_TO_PACKAGE: |
popup.js
popup.html
options_styles.css
MurmurHash3.js
manifest.json
inject_css_override_no_edit.css
inject_css_override_top_only.css
inject_css_override.css
inject_css_suggested.css
inject_css_suggested_no_edit.css
imageWorker.js
bg.jpg
background.js
icons/
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Install the latest Node.js version
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*' # Automatically fetches the latest LTS version
# Read the version from manifest.json
- name: Read version from manifest.json
id: read_version
run: |
VERSION=$(jq -r '.version' < manifest.json)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
# Create a new tag for the release (will wait for the previous step)
- name: Create new tag
run: |
existing_tag=$(git ls-remote --tags origin | grep -n "v${{ env.VERSION }}" || true )
if [ -z "$existing_tag" ]; then
echo "Tag v${{ env.VERSION }} does not exist"
else
echo "Tag v${{ env.VERSION }} already exists"
git push --delete origin "v${{ env.VERSION }}"
fi
git tag "v${{ env.VERSION }}"
git push origin "v${{ env.VERSION }}"
# Create a zip of selected files (from the FILES_TO_PACKAGE environment variable)
- name: Create zip of selected files
run: |
mkdir -p release
FILES=$(echo "${{ env.FILES_TO_PACKAGE }}" | tr '\n' ' ')
zip -r "release/UltimaDark-v${{ env.VERSION }}.zip" $FILES
# Copy the zip file to XPI file
- name: Create xpi file
run: |
cp release/UltimaDark-v${{ env.VERSION }}.zip release/UltimaDark-v${{ env.VERSION }}.xpi
# Create a release on GitHub
- name: Create GitHub Release
id: create_release
uses: comnoco/[email protected]
with:
tag_name: v${{ env.VERSION }}
release_name: v${{ env.VERSION }}
body: |
Release v${{ env.VERSION }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload zip file to the release
- name: Upload assets to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release/UltimaDark-v${{ env.VERSION }}.*
tag: v${{ env.VERSION }}
overwrite: true
file_glob: true