mirror of
https://github.com/yaklang/yaklang-chrome-extension.git
synced 2026-09-22 03:10:43 +08:00
60 lines
1.6 KiB
YAML
60 lines
1.6 KiB
YAML
name: Build and Release
|
|
|
|
on: workflow_dispatch
|
|
|
|
jobs:
|
|
build-and-release:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18'
|
|
cache: 'yarn'
|
|
|
|
- name: Install dependencies
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Build project
|
|
run: yarn build
|
|
|
|
- name: Zip build artifacts
|
|
run: |
|
|
cd build
|
|
zip -r ../extension.zip .
|
|
|
|
- name: Generate version number
|
|
id: version
|
|
run: |
|
|
echo "version=1.0.${{ github.run_number }}" >> $GITHUB_OUTPUT
|
|
echo "build_time=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: v${{ steps.version.outputs.version }}
|
|
release_name: Release v${{ steps.version.outputs.version }}
|
|
body: |
|
|
Branch: ${{ github.ref_name }}
|
|
Commit: ${{ github.sha }}
|
|
Build Time: ${{ steps.version.outputs.build_time }}
|
|
draft: false
|
|
prerelease: false
|
|
|
|
- name: Upload Release Asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./extension.zip
|
|
asset_name: yakit-chrome-extension-v${{ steps.version.outputs.version }}.zip
|
|
asset_content_type: application/zip
|