|
|
|
|
@@ -12,38 +12,35 @@ concurrency:
|
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
install:
|
|
|
|
|
name: 📦 Install & Sync
|
|
|
|
|
prioritize:
|
|
|
|
|
name: ⚡ Prioritize Release
|
|
|
|
|
runs-on: docker
|
|
|
|
|
container:
|
|
|
|
|
image: catthehacker/ubuntu:act-latest
|
|
|
|
|
env:
|
|
|
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
|
|
- name: Install pnpm
|
|
|
|
|
uses: pnpm/action-setup@v4
|
|
|
|
|
with:
|
|
|
|
|
version: 10
|
|
|
|
|
|
|
|
|
|
- name: Set up Node.js
|
|
|
|
|
uses: actions/setup-node@v4
|
|
|
|
|
with:
|
|
|
|
|
node_version: 20
|
|
|
|
|
cache: 'pnpm'
|
|
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
|
|
|
|
|
|
- name: 🏷️ Sync Versions (if Tagged)
|
|
|
|
|
- name: 🛑 Cancel Redundant Runs
|
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
|
run: pnpm sync-versions
|
|
|
|
|
env:
|
|
|
|
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
REPO: ${{ github.repository }}
|
|
|
|
|
RUN_ID: ${{ github.run_id }}
|
|
|
|
|
run: |
|
|
|
|
|
echo "🚀 Release detected. Cancelling non-tag runs..."
|
|
|
|
|
# Get all runs for this repo
|
|
|
|
|
RUNS=$(curl -s -H "Authorization: token $GITEA_TOKEN" "https://git.infra.mintel.me/api/v1/repos/$REPO/actions/runs")
|
|
|
|
|
|
|
|
|
|
# Iterate and cancel in_progress/queued non-tag runs
|
|
|
|
|
echo "$RUNS" | jq -c '.workflow_runs[] | select(.status == "in_progress" or .status == "queued") | select(.id | tostring != "'$RUN_ID'") | select(.event != "push" or .ref | contains("refs/tags/v") | not)' | while read run; do
|
|
|
|
|
ID=$(echo "$run" | jq -r '.id')
|
|
|
|
|
DESC=$(echo "$run" | jq -r '.display_title')
|
|
|
|
|
echo "🛑 Cancelling redundant run $ID ($DESC)..."
|
|
|
|
|
curl -X POST -s -H "Authorization: token $GITEA_TOKEN" "https://git.infra.mintel.me/api/v1/repos/$REPO/actions/runs/$ID/cancel"
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
lint:
|
|
|
|
|
name: 🧹 Lint
|
|
|
|
|
needs: install
|
|
|
|
|
needs: prioritize
|
|
|
|
|
if: always() && !cancelled() && (needs.prioritize.result == 'success' || needs.prioritize.result == 'skipped')
|
|
|
|
|
runs-on: docker
|
|
|
|
|
container:
|
|
|
|
|
image: catthehacker/ubuntu:act-latest
|
|
|
|
|
@@ -52,23 +49,21 @@ jobs:
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
- name: Install pnpm
|
|
|
|
|
uses: pnpm/action-setup@v4
|
|
|
|
|
with:
|
|
|
|
|
version: 10
|
|
|
|
|
- name: Set up Node.js
|
|
|
|
|
uses: actions/setup-node@v4
|
|
|
|
|
with:
|
|
|
|
|
node_version: 20
|
|
|
|
|
cache: 'pnpm'
|
|
|
|
|
- name: Enable pnpm
|
|
|
|
|
run: corepack enable && corepack prepare pnpm@10.2.0 --activate
|
|
|
|
|
- name: Install dependencies
|
|
|
|
|
run: pnpm install --frozen-lockfile --prefer-offline
|
|
|
|
|
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts --no-color
|
|
|
|
|
- name: Lint
|
|
|
|
|
run: pnpm lint
|
|
|
|
|
|
|
|
|
|
test:
|
|
|
|
|
name: 🧪 Test
|
|
|
|
|
needs: install
|
|
|
|
|
needs: prioritize
|
|
|
|
|
if: always() && !cancelled() && (needs.prioritize.result == 'success' || needs.prioritize.result == 'skipped')
|
|
|
|
|
runs-on: docker
|
|
|
|
|
container:
|
|
|
|
|
image: catthehacker/ubuntu:act-latest
|
|
|
|
|
@@ -77,23 +72,21 @@ jobs:
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
- name: Install pnpm
|
|
|
|
|
uses: pnpm/action-setup@v4
|
|
|
|
|
with:
|
|
|
|
|
version: 10
|
|
|
|
|
- name: Set up Node.js
|
|
|
|
|
uses: actions/setup-node@v4
|
|
|
|
|
with:
|
|
|
|
|
node_version: 20
|
|
|
|
|
cache: 'pnpm'
|
|
|
|
|
- name: Enable pnpm
|
|
|
|
|
run: corepack enable && corepack prepare pnpm@10.2.0 --activate
|
|
|
|
|
- name: Install dependencies
|
|
|
|
|
run: pnpm install --frozen-lockfile --prefer-offline
|
|
|
|
|
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts --no-color
|
|
|
|
|
- name: Test
|
|
|
|
|
run: pnpm test
|
|
|
|
|
|
|
|
|
|
build:
|
|
|
|
|
name: 🏗️ Build
|
|
|
|
|
needs: install
|
|
|
|
|
needs: prioritize
|
|
|
|
|
if: always() && !cancelled() && (needs.prioritize.result == 'success' || needs.prioritize.result == 'skipped')
|
|
|
|
|
runs-on: docker
|
|
|
|
|
container:
|
|
|
|
|
image: catthehacker/ubuntu:act-latest
|
|
|
|
|
@@ -102,17 +95,14 @@ jobs:
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
- name: Install pnpm
|
|
|
|
|
uses: pnpm/action-setup@v4
|
|
|
|
|
with:
|
|
|
|
|
version: 10
|
|
|
|
|
- name: Set up Node.js
|
|
|
|
|
uses: actions/setup-node@v4
|
|
|
|
|
with:
|
|
|
|
|
node_version: 20
|
|
|
|
|
cache: 'pnpm'
|
|
|
|
|
- name: Enable pnpm
|
|
|
|
|
run: corepack enable && corepack prepare pnpm@10.2.0 --activate
|
|
|
|
|
- name: Install dependencies
|
|
|
|
|
run: pnpm install --frozen-lockfile --prefer-offline
|
|
|
|
|
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts --no-color
|
|
|
|
|
- name: Build
|
|
|
|
|
run: pnpm build
|
|
|
|
|
|
|
|
|
|
@@ -131,21 +121,16 @@ jobs:
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
with:
|
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
|
|
- name: Install pnpm
|
|
|
|
|
uses: pnpm/action-setup@v4
|
|
|
|
|
with:
|
|
|
|
|
version: 10
|
|
|
|
|
|
|
|
|
|
- name: Set up Node.js
|
|
|
|
|
uses: actions/setup-node@v4
|
|
|
|
|
with:
|
|
|
|
|
node_version: 20
|
|
|
|
|
cache: 'pnpm'
|
|
|
|
|
|
|
|
|
|
- name: Enable pnpm
|
|
|
|
|
run: corepack enable && corepack prepare pnpm@10.2.0 --activate
|
|
|
|
|
- name: Install dependencies
|
|
|
|
|
run: pnpm install --frozen-lockfile --prefer-offline
|
|
|
|
|
|
|
|
|
|
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts --no-color
|
|
|
|
|
- name: 🏷️ Sync Versions (if Tagged)
|
|
|
|
|
run: pnpm sync-versions
|
|
|
|
|
- name: 🏷️ Release Packages (Tag-Driven)
|
|
|
|
|
run: |
|
|
|
|
|
echo "🏷️ Tag detected [${{ github.ref_name }}], performing sync release..."
|
|
|
|
|
|