mirror of
https://github.com/nxtrace/NTrace-core.git
synced 2025-08-12 06:26:39 +00:00
89 lines
2.4 KiB
YAML
89 lines
2.4 KiB
YAML
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
name: Test & Build Release
|
|
jobs:
|
|
Test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: "1.20"
|
|
|
|
- name: Test
|
|
run: sudo go test -v -coverprofile='coverage.out' -covermode=count ./...
|
|
|
|
Build:
|
|
needs: Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: "1.20"
|
|
|
|
- name: compile
|
|
run: bash .cross_compile.sh
|
|
|
|
- name: Upload files to Artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
path: |
|
|
dist/*
|
|
|
|
Release:
|
|
needs: Build
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v1
|
|
with: # 将下述可执行文件 release 上去
|
|
draft: false # Release草稿
|
|
files: |
|
|
dist/*
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GT_Token }}
|
|
|
|
publish-new-formula:
|
|
needs: Release
|
|
# The type of runner that the job will run on
|
|
runs-on: ubuntu-latest
|
|
|
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
steps:
|
|
# Runs a single command using the runners shell
|
|
- name: config git
|
|
run: |
|
|
git config --global user.email "${{ secrets.git_mail }}"
|
|
git config --global user.name "${{ secrets.git_name }}"
|
|
- name: Clone repo
|
|
run: |
|
|
git clone https://github.com/xgadget-lab/homebrew-nexttrace.git
|
|
- name: Exec scipt
|
|
run: |
|
|
cd homebrew-nexttrace
|
|
bash genFormula.sh
|
|
# - name: setup SSH keys and known_hosts
|
|
# run: |
|
|
# mkdir -p ~/.ssh
|
|
# ssh-keyscan github.com >> ~/.ssh/known_hosts
|
|
# ssh-agent -a $SSH_AUTH_SOCK > /dev/null
|
|
# ssh-add - <<< "${{ secrets.ID_RSA }}"
|
|
# env:
|
|
# SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
|
- name: Git Push
|
|
run: |
|
|
cd homebrew-nexttrace
|
|
git commit -am 'Publish a new version with Formula' || true
|
|
git remote set-url origin https://${{ secrets.gt_token }}@github.com/xgadget-lab/homebrew-nexttrace.git
|
|
git push
|
|
# env:
|
|
# SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
|
- run: echo "🍏 This job's status is ${{ job.status }}."
|