feat: add CI workflow for build and versioning
All checks were successful
CI / build-and-publish (push) Successful in 25s
All checks were successful
CI / build-and-publish (push) Successful in 25s
This commit is contained in:
61
.gitea/workflows/dev.yml
Normal file
61
.gitea/workflows/dev.yml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [dev]
|
||||||
|
pull_request:
|
||||||
|
branches: [dev]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '24'
|
||||||
|
|
||||||
|
- run: npm install --only=dev
|
||||||
|
|
||||||
|
- name: web-ext lint
|
||||||
|
run: npx web-ext lint -v
|
||||||
|
|
||||||
|
- name: Increment Version and Commit
|
||||||
|
if: github.event_name == 'push' # Only push back on actual merges/pushes, not PRs
|
||||||
|
run: |
|
||||||
|
# 1. Increment logic
|
||||||
|
VERSION=$(jq -r '.version' manifest.json)
|
||||||
|
BASE=$(echo $VERSION | cut -d. -f1-2)
|
||||||
|
PATCH=$(echo $VERSION | cut -d. -f3)
|
||||||
|
NEW_VERSION="$BASE.$((PATCH + 1))"
|
||||||
|
|
||||||
|
# Update manifest.json version
|
||||||
|
jq ".version = \"$NEW_VERSION\"" manifest.json > temp.manifest.json && mv temp.manifest.json manifest.json
|
||||||
|
|
||||||
|
# Keep package.json version in sync, if present
|
||||||
|
if [ -f package.json ]; then
|
||||||
|
jq ".version = \"$NEW_VERSION\"" package.json > temp.package.json && mv temp.package.json package.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2. Git Config
|
||||||
|
git config --local user.email "space@reversed.dev"
|
||||||
|
git config --local user.name "space"
|
||||||
|
|
||||||
|
# 3. Commit (push will be done after publish)
|
||||||
|
git add manifest.json package.json
|
||||||
|
git commit -m "chore: bump version to $NEW_VERSION [skip ci]"
|
||||||
|
|
||||||
|
- name: web-ext build
|
||||||
|
run: npx web-ext build -s . -a dist --overwrite-dest
|
||||||
|
|
||||||
|
- name: Upload build artifact
|
||||||
|
# v4+ not supported on Gitea Actions/Forgejo, use v3 for compatibility
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: web-ext-build
|
||||||
|
path: dist/
|
||||||
|
|
||||||
|
- name: Push changes
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
run: git push
|
||||||
Reference in New Issue
Block a user