diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12475bc1..0f17355c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: - "v[0-9]*" jobs: - goreleaser: + prepare-ui: runs-on: ubuntu-latest steps: - name: Checkout @@ -19,34 +19,111 @@ jobs: with: node-version: 20.11.0 + - name: Build WebUI + run: | + npm --prefix=./ui ci + npm --prefix=./ui run build + + - name: Upload UI build artifacts + uses: actions/upload-artifact@v4 + with: + name: ui-build + path: ./ui/dist + retention-days: 1 + + release-linux: + needs: prepare-ui + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: "go.mod" - # - name: Install upx (optional) - # run: | - # sudo apt-get update - # sudo apt-get install -y upx - - - name: Build WebUI - run: | - npm --prefix=./ui ci - npm --prefix=./ui run build - npm cache clean --force - rm -rf ./ui/node_modules + - name: Download UI build artifacts + uses: actions/download-artifact@v4 + with: + name: ui-build + path: ./ui/dist - name: Check disk usage - run: | - df -h - du -sh /opt/hostedtoolcache/go/* + run: df -h - - name: Run GoReleaser + - name: Run GoReleaser for Linux uses: goreleaser/goreleaser-action@v5 with: distribution: goreleaser version: latest - args: release --clean + args: release --clean --config .goreleaser.linux.yml + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + + release-macos: + needs: prepare-ui + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + + - name: Download UI build artifacts + uses: actions/download-artifact@v4 + with: + name: ui-build + path: ./ui/dist + + - name: Check disk usage + run: df -h + + - name: Run GoReleaser for macOS + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release --clean --config .goreleaser.macos.yml + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + + release-windows: + needs: prepare-ui + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + + - name: Download UI build artifacts + uses: actions/download-artifact@v4 + with: + name: ui-build + path: ./ui/dist + + - name: Check disk usage + run: df -h + + - name: Run GoReleaser for Windows + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release --clean --config .goreleaser.windows.yml env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} diff --git a/.goreleaser.linux.yml b/.goreleaser.linux.yml new file mode 100644 index 00000000..edde23c3 --- /dev/null +++ b/.goreleaser.linux.yml @@ -0,0 +1,52 @@ +# .goreleaser.linux.yml +project_name: certimate + +dist: .builds/linux + +before: + hooks: + - go mod tidy + +builds: + - id: build_linux + main: ./ + binary: certimate + ldflags: + - -s -w -X github.com/usual2970/certimate.Version={{ .Version }} + env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 + - arm64 + - arm + goarm: + - 7 + +release: + draft: true + ids: + - linux + +archives: + - id: archive_linux + builds: [build_linux] + format: "zip" + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + files: + - CHANGELOG.md + - LICENSE.md + - README.md + +checksum: + name_template: "checksums_linux.txt" + +snapshot: + name_template: "{{ incpatch .Version }}-next" + +changelog: + sort: asc + filters: + exclude: + - "^ui:" \ No newline at end of file diff --git a/.goreleaser.macos.yml b/.goreleaser.macos.yml new file mode 100644 index 00000000..b4f97c0e --- /dev/null +++ b/.goreleaser.macos.yml @@ -0,0 +1,49 @@ +# .goreleaser.macos.yml +project_name: certimate + +dist: .builds/macos + +before: + hooks: + - go mod tidy + +builds: + - id: build_macos + main: ./ + binary: certimate + ldflags: + - -s -w -X github.com/usual2970/certimate.Version={{ .Version }} + env: + - CGO_ENABLED=0 + goos: + - darwin + goarch: + - amd64 + - arm64 + +release: + draft: true + ids: + - macos + +archives: + - id: archive_macos + builds: [build_macos] + format: "zip" + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + files: + - CHANGELOG.md + - LICENSE.md + - README.md + +checksum: + name_template: "checksums_macos.txt" + +snapshot: + name_template: "{{ incpatch .Version }}-next" + +changelog: + sort: asc + filters: + exclude: + - "^ui:" \ No newline at end of file diff --git a/.goreleaser.windows.yml b/.goreleaser.windows.yml new file mode 100644 index 00000000..821527d7 --- /dev/null +++ b/.goreleaser.windows.yml @@ -0,0 +1,52 @@ +# .goreleaser.windows.yml +project_name: certimate + +dist: .builds/windows + +before: + hooks: + - go mod tidy + +builds: + - id: build_windows + main: ./ + binary: certimate + ldflags: + - -s -w -X github.com/usual2970/certimate.Version={{ .Version }} + env: + - CGO_ENABLED=0 + goos: + - windows + goarch: + - amd64 + - arm64 + ignore: + - goos: windows + goarch: arm + +release: + draft: true + ids: + - windows + +archives: + - id: archive_windows + builds: [build_windows] + format: "zip" + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + files: + - CHANGELOG.md + - LICENSE.md + - README.md + +checksum: + name_template: "checksums_windows.txt" + +snapshot: + name_template: "{{ incpatch .Version }}-next" + +changelog: + sort: asc + filters: + exclude: + - "^ui:" \ No newline at end of file