From e9fe0b98fb05c314eab9b991d44f9a27c7e78bdd Mon Sep 17 00:00:00 2001 From: greyh4t Date: Tue, 5 Sep 2023 02:26:05 +0800 Subject: [PATCH] add github workflow --- .github/workflows/release.yaml | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..521d34f --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,39 @@ +name: release +on: + release: + types: [created] +jobs: + release: + runs-on: ubuntu-latest + strategy: + matrix: + goos: [linux, windows, darwin] + goarch: [amd64, arm64] + exclude: + - goarch: arm64 + goos: windows + steps: + - uses: actions/checkout@v3 + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: 1.21 + - name: Build + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + run: | + name=m3u8-Downloader-Go + output=${name} + if [ "${{ matrix.goos }}" == "windows" ]; then + output=${name}.exe + fi + echo "TGZ_FILE=${name}_${{ matrix.goos }}_${{ matrix.goarch }}.tgz" >> $GITHUB_ENV + echo "OUTPUT_FILE=${output}" >> $GITHUB_ENV + go build -ldflags="-s -w" -o ${output} ./ + - name: Pack + run: tar czf ${{ env.TGZ_FILE }} ${{ env.OUTPUT_FILE }} + - name: Upload + uses: softprops/action-gh-release@v1 + with: + files: ${{ env.TGZ_FILE }}