From 56d3dd7237b7eb997e5dd3f5b61026fcc7536267 Mon Sep 17 00:00:00 2001 From: JACKYMYPERSON <108354972+JACKYMYPERSON@users.noreply.github.com> Date: Mon, 15 Sep 2025 23:08:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BAworkflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..d818c56 --- /dev/null +++ b/.github/workflows/main.yml @@ -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 + +