From 7f7348ebd31bb59ef7481299147587758663de61 Mon Sep 17 00:00:00 2001 From: Banglanfeng Pan Date: Mon, 21 Oct 2024 18:02:30 -0400 Subject: [PATCH 1/3] added release workflow --- .github/workflows/release-wattpad.yml | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/release-wattpad.yml diff --git a/.github/workflows/release-wattpad.yml b/.github/workflows/release-wattpad.yml new file mode 100644 index 0000000000..276d8cb747 --- /dev/null +++ b/.github/workflows/release-wattpad.yml @@ -0,0 +1,48 @@ +name: Build and Release + +on: + release: + types: [ published ] + +jobs: + build: + name: Build and Release + runs-on: ubuntu-latest + + strategy: + matrix: + go_os: [ linux, darwin, windows ] + go_arch: [ amd64, arm64 ] + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.22.x + + # Build the go-task binary from the current repository + - name: Build go-task for ${{ matrix.go_os }}-${{ matrix.go_arch }} + run: | + GOOS=${{ matrix.go_os }} \ + GOARCH=${{ matrix.go_arch }} \ + go build \ + -o task \ + ./cmd/task + + # Compress the go-task binary + - name: Compress go-task for ${{ matrix.go_os }}-${{ matrix.go_arch }} + run: | + tar -cvzf task_${{ matrix.go_os }}_${{ matrix.go_arch }}.tar.gz \ + task \ + README.md \ + LICENSE \ + completion/ + + - name: Upload Release Asset + env: + GITHUB_TOKEN: ${{ secrets.GH_PAT }} + run: | + gh release upload ${{ github.event.release.tag_name }} ./task_${{ matrix.go_os }}_${{ matrix.go_arch }}.tar.gz From 51143d65bb2ade4233f126a0e2c2c75c873aab72 Mon Sep 17 00:00:00 2001 From: Banglanfeng Pan Date: Wed, 23 Oct 2024 11:03:27 -0400 Subject: [PATCH 2/3] set CGO_enabled 0 --- .github/workflows/release-wattpad.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-wattpad.yml b/.github/workflows/release-wattpad.yml index 276d8cb747..347054730a 100644 --- a/.github/workflows/release-wattpad.yml +++ b/.github/workflows/release-wattpad.yml @@ -28,6 +28,7 @@ jobs: run: | GOOS=${{ matrix.go_os }} \ GOARCH=${{ matrix.go_arch }} \ + CGO_ENABLED=0 \ go build \ -o task \ ./cmd/task From 859b16b4e1f40f24e5a705446e5c75242f5aca4d Mon Sep 17 00:00:00 2001 From: Banglanfeng Pan Date: Wed, 23 Oct 2024 11:49:13 -0400 Subject: [PATCH 3/3] use the automatical token --- .github/workflows/release-wattpad.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-wattpad.yml b/.github/workflows/release-wattpad.yml index 347054730a..00312c0d0a 100644 --- a/.github/workflows/release-wattpad.yml +++ b/.github/workflows/release-wattpad.yml @@ -44,6 +44,6 @@ jobs: - name: Upload Release Asset env: - GITHUB_TOKEN: ${{ secrets.GH_PAT }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release upload ${{ github.event.release.tag_name }} ./task_${{ matrix.go_os }}_${{ matrix.go_arch }}.tar.gz