From d4a3782d4d8693047452bcab314360a65535220e Mon Sep 17 00:00:00 2001 From: Feng <24779889+shfc@users.noreply.github.com> Date: Sat, 3 Aug 2024 12:09:02 +0000 Subject: [PATCH 1/3] feat: add workflows for release --- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8d617fb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release + +on: + push: + tags: + - "*" + +env: + GO_VERSION: 1.16 + CGO_ENABLED: 0 + GO111MODULE: on + +jobs: + build: + name: Build + strategy: + matrix: + os: [ linux, windows, darwin ] + arch: [ amd64, arm64, 386 ] + runs-on: ubuntu-latest + env: + GOOS: ${{ matrix.os }} + GOARCH: ${{ matrix.arch }} + steps: + - name: Checkout Git repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Get dependencies + run: | + go mod download + + - name: Build binary + run: | + GOOS=${GOOS} GOARCH=${GOARCH} go build -o ./Releases/m3u8-${GOOS}-${GOARCH} m3u8-downloader.go + + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + ./Releases/* \ No newline at end of file From d92c2487195021c5fbd08ba953dbe4f57b3f5eae Mon Sep 17 00:00:00 2001 From: Feng <24779889+shfc@users.noreply.github.com> Date: Sat, 3 Aug 2024 12:20:52 +0000 Subject: [PATCH 2/3] fix: exclude darwin/386 Go 1.15 drops support for 32-bit binaries on macOS, iOS, iPadOS, watchOS, and tvOS --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d617fb..bd60d5d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: - "*" env: - GO_VERSION: 1.16 + GO_VERSION: 1.17 CGO_ENABLED: 0 GO111MODULE: on @@ -17,6 +17,9 @@ jobs: matrix: os: [ linux, windows, darwin ] arch: [ amd64, arm64, 386 ] + exclude: + - os: darwin + arch: 386 runs-on: ubuntu-latest env: GOOS: ${{ matrix.os }} From 3fc8d742ef7ec2cf7bd5f057fc76f291c7a2c179 Mon Sep 17 00:00:00 2001 From: Feng <24779889+shfc@users.noreply.github.com> Date: Sat, 3 Aug 2024 12:51:40 +0000 Subject: [PATCH 3/3] feat: add exe for Windows binary --- .github/workflows/release.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd60d5d..573c54f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,9 @@ jobs: matrix: os: [ linux, windows, darwin ] arch: [ amd64, arm64, 386 ] + include: + - os: windows + file-extension: ".exe" exclude: - os: darwin arch: 386 @@ -24,6 +27,7 @@ jobs: env: GOOS: ${{ matrix.os }} GOARCH: ${{ matrix.arch }} + FILEEXTENSION: ${{ matrix.file-extension }} steps: - name: Checkout Git repo uses: actions/checkout@v4 @@ -41,7 +45,7 @@ jobs: - name: Build binary run: | - GOOS=${GOOS} GOARCH=${GOARCH} go build -o ./Releases/m3u8-${GOOS}-${GOARCH} m3u8-downloader.go + GOOS=${GOOS} GOARCH=${GOARCH} go build -o ./Releases/m3u8-${GOOS}-${GOARCH}${FILEEXTENSION} m3u8-downloader.go - name: Release uses: softprops/action-gh-release@v2