diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..497cf26 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,48 @@ +name: Release + +on: + push: + tags: + - 'v*.*.*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Cross building + run: | + PREFIX=.build/tcp-over-bt + + # args: OS ARCH HOST/DEVICE + _build() { GOOS=$1 GOARCH=$2 go build -o $PREFIX-$1-$2-$3; } + + _build linux arm64 device & + _build darwin arm64 host & + + wait + - name: Generate body + run: | + echo '**Build At**: + + * `'"$(date)"'` + * `'"$(TZ=Asia/Shanghai date)"'` + + **sha256sum**: + + ```- + '"$(cd .build && sha256sum *)"' + ``` + ' > .build/body.md + - name: Create Release + uses: ncipollo/release-action@v1.14.0 + with: + allowUpdates: true + artifactErrorsFailBuild: true + replacesArtifacts: true + artifacts: .build/* + tag: release-main-latest + bodyFile: body.md