Skip to content

Merge pull request #16 from ut-code/lv5 #6

Merge pull request #16 from ut-code/lv5

Merge pull request #16 from ut-code/lv5 #6

Workflow file for this run

name: build-and-release
on:
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: build-and-release-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install deps
run: npm ci
- name: Build
run: npm run build
- name: Resolve version (Node only)
id: ver
shell: bash
run: |
VERSION=$(node - <<'NODE'
const fs = require('fs');
const read = p => { try { return JSON.parse(fs.readFileSync(p, 'utf8')).version } catch { return null } };
process.stdout.write(read('dist/manifest.json') || read('manifest.json') || read('package.json') || '0.0.0');
NODE
)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Zip dist
shell: bash
run: |
mkdir -p artifacts
(cd dist && zip -r "../artifacts/extension-v${{ steps.ver.outputs.version }}.zip" .)
cp "artifacts/extension-v${{ steps.ver.outputs.version }}.zip" "artifacts/extension.zip"
- name: Create GitHub Release and upload assets
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.ver.outputs.version }}
name: v${{ steps.ver.outputs.version }}
draft: false
prerelease: false
generate_release_notes: true
files: |
artifacts/extension-v${{ steps.ver.outputs.version }}.zip
artifacts/extension.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}