-
Notifications
You must be signed in to change notification settings - Fork 38
60 lines (54 loc) · 1.68 KB
/
auto-compile-and-commit.yml
File metadata and controls
60 lines (54 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Go Build and Compile
on:
push:
branches:
- main
workflow_dispatch:
# 可以添加可选的输入参数
inputs:
reason:
description: 'Reason for manual run'
required: false
default: 'Manual trigger'
jobs:
build-and-compile:
runs-on: ubuntu-latest
# 设置权限,允许 push
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4 # 使用最新版本
- name: Set up Go environment
uses: actions/setup-go@v5 # 使用最新版本
with:
go-version: '1.23'
check-latest: true
# 使用环境变量
- name: Build and compile
env:
LLM_BASEURL: ${{ secrets.LLM_BASEURL }}
LLM_TOKEN: ${{ secrets.LLM_TOKEN }}
run: |
go build -o ./bin/starProject
- name: Execute compiled binary
env:
LLM_BASEURL: ${{ secrets.LLM_BASEURL }}
LLM_TOKEN: ${{ secrets.LLM_TOKEN }}
USERNAME: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./bin/starProject
- name: Copy aiTagProcess.json to web/public
run: |
cp aiTagProcess.json web/public/projects.json
- name: Commit all files
# 使用 GITHUB_TOKEN 进行 git 操作
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Automated commit after execution" || echo "No changes to commit"
git push