Files
kutt-extension/.github/workflows/build.yml
2026-01-04 04:32:56 +05:30

83 lines
2.0 KiB
YAML

name: Build and Deploy
run-name: ${{ github.actor }} started build action
on:
push:
branches:
- master
tags:
- 'v*.*.*'
pull_request:
branches:
- master
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: '${{ github.workflow }}-${{ github.ref }}'
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Build for all browsers
run: npm run build
- name: Upload Chrome extension artifact
uses: actions/upload-artifact@v4
with:
name: chrome-extension
path: extension/chrome.zip
- name: Upload Firefox extension artifact
uses: actions/upload-artifact@v4
with:
name: firefox-extension
path: extension/firefox.xpi
deploy:
needs: build
runs-on: ubuntu-latest
# Only deploy when a tag is pushed (e.g., v1.0.0)
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Build for all browsers
run: npm run build
- name: Deploy to extension branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./extension
publish_branch: extension
keep_files: false