创建workflow
This commit is contained in:
43
.github/workflows/main.yml
vendored
Normal file
43
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
name: Golang CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
jobs:
|
||||||
|
test-go:
|
||||||
|
runs-on: centos-latest
|
||||||
|
steps:
|
||||||
|
- name: code-pull
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: setup-goenv
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: '1.24.7'
|
||||||
|
- name: verify go mod
|
||||||
|
run: go mod verify
|
||||||
|
- name: go build
|
||||||
|
run: go build -v ./...
|
||||||
|
- name: go test
|
||||||
|
run: go test -v ./...
|
||||||
|
send-email:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: install email tool
|
||||||
|
run: |
|
||||||
|
yum install -y
|
||||||
|
yum install -y curl sendmail
|
||||||
|
- name: send email
|
||||||
|
env:
|
||||||
|
SMTP_SERVER: ${{ secrets.SMTP_SERVER }}
|
||||||
|
SMTP_PORT: ${{ secrets.SMTP_PORT }}
|
||||||
|
EMAIL_USER: ${{ secrets.EMAIL_USER }}
|
||||||
|
EMAIL_PASS: ${{ secrets.EMAIL_PASS }}
|
||||||
|
TO_EMAIL: 1627832236@qq.com
|
||||||
|
run: |
|
||||||
|
echo "Subject: 推送仓库成功" > email.txt
|
||||||
|
echo "From: $EMAIL_USER" >> email.txt
|
||||||
|
echo "To: $TO_EMAIL" >> email.txt
|
||||||
|
echo "" >> email.txt
|
||||||
|
echo "有新的内容推送到仓库toutoukan" >> email.txt
|
||||||
|
sendmail -S "$SMTP_SERVER:$SMTP_PORT" -au"$EMAIL_USER" -ap"$EMAIL_PASS" $TO_EMAIL < email.txt
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user