ci: add build ci
This commit is contained in:
parent
2fec735d66
commit
a85c1dd911
48
.github/workflows/build.yaml
vendored
Normal file
48
.github/workflows/build.yaml
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
name: Check and Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, ' [build]') }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up git
|
||||||
|
run: |
|
||||||
|
git config --global user.name "github-actions[bot]"
|
||||||
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.22"
|
||||||
|
# cache: false # set to be true by default. Disable cache when debugging
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
cd others/script
|
||||||
|
go mod tidy
|
||||||
|
|
||||||
|
- name: Check and build
|
||||||
|
run: |
|
||||||
|
cd others/script
|
||||||
|
go run main.go --rime_path "${{ github.workspace }}" --auto_confirm
|
||||||
|
|
||||||
|
- name: Commit and push
|
||||||
|
run: |
|
||||||
|
git add --all
|
||||||
|
if ! git diff --cached --quiet; then
|
||||||
|
COMMIT_MSG=$(git log -1 --pretty=%B | sed -e 's/\s\[build\]$//' -e 's/^[a-zA-Z()]*:\s*//')
|
||||||
|
git commit -m "build(ci): auto build for -> ${COMMIT_MSG} <-"
|
||||||
|
git push
|
||||||
|
else
|
||||||
|
echo "No changes to commit."
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user