fix: rewrite workflows without GitHub marketplace actions
Some checks failed
CI — Test & Build / Test & Build (push) Failing after 1m13s

- Use native git clone instead of actions/checkout
- Use node:22-bookworm container directly
- Remove dependency on actions/setup-node, upload-artifact
- Use curl for Gitea API calls directly
- Fixes CI failure on self-hosted runner
This commit is contained in:
Forge
2026-03-06 13:18:27 +08:00
parent 41db281824
commit 7f16bd886f
3 changed files with 75 additions and 103 deletions

View File

@@ -3,65 +3,60 @@ name: Release — Package & Publish
on:
push:
tags:
- 'v*.*.*' # Triggers on: git tag v0.1.0 && git push --tags
- 'v*.*.*'
jobs:
release:
name: Build & Package Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
container:
image: node:22-bookworm
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
steps:
- name: Install zip
run: apt-get update -qq && apt-get install -y zip curl
- name: Checkout
run: |
git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git .
git checkout ${{ gitea.sha }}
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
run: npm test -- --run
- name: Build extension
run: npm run build
- name: Package as ZIP (Chrome Web Store)
run: npm run zip
- name: Package as ZIP
run: |
VERSION=${{ gitea.ref_name }}
zip -r lexai-chrome-mv3-${VERSION}.zip .output/chrome-mv3/
echo "ZIP_FILE=lexai-chrome-mv3-${VERSION}.zip" >> $GITHUB_ENV
- name: Get version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create Gitea Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: LexAI ${{ steps.version.outputs.VERSION }}
body: |
## LexAI ${{ steps.version.outputs.VERSION }}
### Installation
1. Download `lexai-chrome-mv3.zip` below
2. Go to `chrome://extensions`
3. Enable Developer Mode
4. Click "Load unpacked" → extract the zip first
### What's new
See CHANGELOG.md for details.
draft: false
prerelease: false
- name: Create Release
run: |
VERSION=${{ gitea.ref_name }}
curl -s -X POST "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{
\"tag_name\": \"${VERSION}\",
\"name\": \"LexAI ${VERSION}\",
\"body\": \"## LexAI ${VERSION}\n\n### Installation\n1. Download ZIP below\n2. Extract it\n3. Open Chrome → chrome://extensions\n4. Enable Developer Mode\n5. Click Load unpacked → select the extracted folder\",
\"draft\": false,
\"prerelease\": false
}" > release.json
cat release.json
echo "RELEASE_ID=$(cat release.json | grep -o '\"id\":[0-9]*' | head -1 | cut -d: -f2)" >> $GITHUB_ENV
- name: Upload ZIP to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .output/lexai-*.zip
asset_name: lexai-chrome-mv3-${{ steps.version.outputs.VERSION }}.zip
asset_content_type: application/zip
run: |
VERSION=${{ gitea.ref_name }}
RELEASE_ID=${{ env.RELEASE_ID }}
curl -s -X POST "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets" \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-F "attachment=@lexai-chrome-mv3-${VERSION}.zip"
echo "✅ Release ${VERSION} published!"