diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e9ccd5..253802d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,22 +3,22 @@ name: Build and Release on: workflow_dispatch: release: - types: [released,prereleased] + types: [ released,prereleased ] + - jobs: build: permissions: contents: write strategy: matrix: - goos: [windows, linux, darwin] - goarch: [amd64, arm64] + goos: [ windows, linux, darwin ] + goarch: [ amd64, arm64 ] runs-on: ubuntu-latest - env: - CGO_ENABLED: 0 - GOOS: ${{ matrix.goos }} - GOARCH: ${{ matrix.goarch }} + env: + CGO_ENABLED: 0 + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} steps: - name: Get version id: get_version @@ -37,27 +37,27 @@ jobs: check-latest: true - name: Gen output name run: | - echo "FILENAME=pmail_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV} - echo "TGFILENAME=telegram_push_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV} - echo "WCFILENAME=wechat_push_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV} - echo "WEBFILENAME=web_push_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV} + echo "FILENAME=pmail_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV} + echo "TGFILENAME=telegram_push_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV} + echo "WCFILENAME=wechat_push_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV} + echo "WEBFILENAME=web_push_${{ matrix.goos }}_${{ matrix.goarch }}" >> ${GITHUB_ENV} - name: Rename Windows File if: matrix.goos == 'windows' run: | - echo "FILENAME=pmail_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV} - echo "TGFILENAME=telegram_push_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV} - echo "WCFILENAME=wechat_push_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV} - echo "WEBFILENAME=web_push_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV} + echo "FILENAME=pmail_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV} + echo "TGFILENAME=telegram_push_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV} + echo "WCFILENAME=wechat_push_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV} + echo "WEBFILENAME=web_push_${{ matrix.goos }}_${{ matrix.goarch }}.exe" >> ${GITHUB_ENV} - name: FE Build run: cd fe && yarn && yarn build - name: BE Build run: | - cd server && cp -rf ../fe/dist http_server - go build -ldflags "-s -w -X 'main.version=${{ env.VERSION }}' -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o ${{ env.FILENAME }} main.go - go build -ldflags "-s -w" -o ${{ env.TGFILENAME }} hooks/telegram_push/telegram_push.go - go build -ldflags "-s -w" -o ${{ env.WEBFILENAME }} hooks/web_push/web_push.go - go build -ldflags "-s -w" -o ${{ env.WCFILENAME }} hooks/wechat_push/wechat_push.go - ls -alh + cd server && cp -rf ../fe/dist http_server + go build -ldflags "-s -w -X 'main.version=${{ env.VERSION }}' -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o ${{ env.FILENAME }} main.go + go build -ldflags "-s -w" -o ${{ env.TGFILENAME }} hooks/telegram_push/telegram_push.go + go build -ldflags "-s -w" -o ${{ env.WEBFILENAME }} hooks/web_push/web_push.go + go build -ldflags "-s -w" -o ${{ env.WCFILENAME }} hooks/wechat_push/wechat_push.go + ls -alh - name: Upload files to Artifacts uses: actions/upload-artifact@v3 with: @@ -71,10 +71,28 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: | - ./server/${{ env.FILENAME }} - ./server/${{ env.TGFILENAME }} - ./server/${{ env.WEBFILENAME }} - ./server/${{ env.WCFILENAME }} + file: ./server/${{ env.FILENAME }} tag: ${{ github.ref }} file_glob: true + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: + ./server/${{ env.TGFILENAME }} + tag: ${{ github.ref }} + file_glob: true + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./server/${{ env.WEBFILENAME }} + tag: ${{ github.ref }} + file_glob: true + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./server/${{ env.WCFILENAME }} + tag: ${{ github.ref }} + file_glob: true \ No newline at end of file