mirror of
https://github.com/MengMengCode/CLICD.git
synced 2026-08-05 05:36:07 +08:00
67 lines
1.6 KiB
YAML
67 lines
1.6 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
tags:
|
|
- "v*"
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
linux-amd64:
|
|
name: Linux amd64
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: npm
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.22.x"
|
|
cache-dependency-path: backend/go.sum
|
|
|
|
- name: Build
|
|
shell: bash
|
|
run: bash build.sh
|
|
|
|
- name: Package
|
|
shell: bash
|
|
run: |
|
|
mkdir -p dist package/clicd-linux-amd64
|
|
cp build/clicd package/clicd-linux-amd64/clicd
|
|
cp build/install.sh package/clicd-linux-amd64/install.sh
|
|
chmod +x package/clicd-linux-amd64/clicd package/clicd-linux-amd64/install.sh
|
|
tar -C package -czf dist/clicd-linux-amd64.tar.gz clicd-linux-amd64
|
|
cp build/clicd dist/clicd-linux-amd64
|
|
sha256sum dist/* > dist/SHA256SUMS
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: clicd-linux-amd64
|
|
path: dist/*
|
|
|
|
- name: Publish GitHub Release
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
shell: bash
|
|
run: |
|
|
gh release create "$GITHUB_REF_NAME" dist/* --generate-notes || \
|
|
gh release upload "$GITHUB_REF_NAME" dist/* --clobber
|