From 12525e52a29726743883405835762b7cde316dc2 Mon Sep 17 00:00:00 2001 From: rook1e Date: Mon, 23 Dec 2024 12:40:27 +0800 Subject: [PATCH] chore: clean up release workfow --- .github/workflows/release.yml | 74 +++-------------------------------- .goreleaser.darwin.yaml | 26 ------------ .goreleaser.linux.yaml | 49 ----------------------- .goreleaser.yaml | 26 +++++++++++- 4 files changed, 31 insertions(+), 144 deletions(-) delete mode 100644 .goreleaser.darwin.yaml delete mode 100644 .goreleaser.linux.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b62ddd..651c024 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,90 +9,28 @@ permissions: contents: write jobs: - build_fe: + release: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 0 // for vite extracting git tag/hash - name: Set up Node uses: actions/setup-node@v4 with: node-version: 22 - - name: Build - working-directory: frontend + - name: Build FE run: | - npm i && npm run build - - name: Upload dist - uses: actions/upload-artifact@v4 - with: - name: fe_dist - path: frontend/build - retention-days: 1 - build_be: - needs: build_fe - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Download the dist of FE - uses: actions/download-artifact@v4 - with: - name: fe_dist - path: frontend/build/ + ./scripts.sh build-frontend - name: Set up Go uses: actions/setup-go@v5 with: go-version: "1.23" - - name: Build for Darwin - if: ${{ startsWith(matrix.os, 'macos') }} - uses: goreleaser/goreleaser-action@v6 - with: - args: release --skip=publish --clean --config .goreleaser.darwin.yaml - - name: Prepare for Linux and Windows - if: ${{ startsWith(matrix.os, 'ubuntu') }} - run: | - sudo apt-get install -y gcc-aarch64-linux-gnu gcc-mingw-w64 - - name: Build for Linux and Windows - if: ${{ startsWith(matrix.os, 'ubuntu') }} - uses: goreleaser/goreleaser-action@v6 - with: - args: release --skip=publish --clean --config .goreleaser.linux.yaml - - name: Upload dist - uses: actions/upload-artifact@v4 - with: - name: "be_${{ matrix.os }}_dist" - path: | - dist/*.zip - dist/*_checksums.txt - retention-days: 1 - publish: - needs: [build_be] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 # for goreleaser generating changelog - - name: Download the dist of BE - uses: actions/download-artifact@v4 - with: - pattern: be_*_dist - path: ./build/ - merge-multiple: true - - name: Merge checksums - working-directory: ./build - run: | - cat *_checksums.txt >> checksums.txt - rm *_checksums.txt - - name: Publish release + - name: Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser - args: release --config .goreleaser.yaml + args: release --clean diff --git a/.goreleaser.darwin.yaml b/.goreleaser.darwin.yaml deleted file mode 100644 index ad527d8..0000000 --- a/.goreleaser.darwin.yaml +++ /dev/null @@ -1,26 +0,0 @@ -version: 2 -dist: ./dist -builds: - - binary: fusion - main: ./cmd/server - env: - - CGO_ENABLED=1 - goos: - - darwin - goarch: - - amd64 - - arm64 - -archives: - - id: default - format: zip - files: - - "LICENSE*" - - "README*" - -checksum: - algorithm: sha256 - name_template: "darwin_checksums.txt" - -snapshot: - name_template: "{{ incpatch .Version }}-next" diff --git a/.goreleaser.linux.yaml b/.goreleaser.linux.yaml deleted file mode 100644 index e0cfbb8..0000000 --- a/.goreleaser.linux.yaml +++ /dev/null @@ -1,49 +0,0 @@ -version: 2 -dist: ./dist -builds: - - binary: fusion - main: ./cmd/server - env: - # gcc-aarch64-linux-gnu is required - # gcc-mingw-w64 are required for windows - - CGO_ENABLED=1 - goos: - - linux - - windows - goarch: - - amd64 - - arm64 - ignore: - # TODO: gcc-mingw-w64 on linux-arm64 not includes aarch64-w64-mingw32-gcc - - goos: windows - goarch: arm64 - overrides: - - goos: linux - goarch: arm64 - env: - - CC=aarch64-linux-gnu-gcc - # - goos: windows - # goarch: arm64 - # env: - # - CC=aarch64-w64-mingw32-gcc - # - CXX=aarch64-w64-mingw32-g++ - - goos: windows - goarch: amd64 - goamd64: v1 - env: - - CC=x86_64-w64-mingw32-gcc - - CXX=x86_64-w64-mingw32-g++ - -archives: - - id: default - format: zip - files: - - "LICENSE*" - - "README*" - -checksum: - algorithm: sha256 - name_template: "linux_checksums.txt" - -snapshot: - name_template: "{{ incpatch .Version }}-next" diff --git a/.goreleaser.yaml b/.goreleaser.yaml index fd3489b..5c64592 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,6 +1,30 @@ version: 2 +dist: ./dist + builds: - - skip: true + - binary: fusion + main: ./cmd/server + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + +archives: + - id: default + format: zip + files: + - "LICENSE*" + - "README*" + +checksum: + algorithm: sha256 + name_template: "checksums.txt" + +snapshot: + name_template: "{{ incpatch .Version }}-next" changelog: use: github