Skip to content

Commit

Permalink
t
Browse files Browse the repository at this point in the history
  • Loading branch information
0x2E committed Apr 9, 2024
1 parent c86b8c8 commit 1eef55e
Show file tree
Hide file tree
Showing 8 changed files with 275 additions and 144 deletions.
91 changes: 80 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,98 @@ permissions:
contents: write

jobs:
release:
build_fe:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # for goreleaser generating changelog
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
fetch-depth: 0
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 21
- name: Build
working-directory: frontend
run: |
./scripts.sh build
- name: Run GoReleaser
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/
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Build for Darwin
if: ${{ startsWith(matrix.os, 'macos') }}
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
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
if: ${{ startsWith(matrix.os, 'ubuntu') }}
uses: goreleaser/goreleaser-action@v5
with:
args: release --skip=publish --clean --config .goreleaser.linux.yaml
- name: Build for Windows
if: ${{ startsWith(matrix.os, 'ubuntu') }}
uses: goreleaser/goreleaser-action@v5
with:
args: release --skip=publish --clean --config .goreleaser.windows.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: Create dist dir
run: |
mkdir -p ./dist/
- name: Download the dist of BE
uses: actions/download-artifact@v4
with:
pattern: be_*_dist
path: ./dist/
merge-multiple: true
- name: Merge checksums
working-directory: ./dist
run: |
cat *_checksums.txt >> checksums.txt
rm *_checksums.txt
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # for goreleaser generating changelog
- name: Publish release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
args: release --config .goreleaser.yaml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*.paw
tmp/
build/
dist/
22 changes: 22 additions & 0 deletions .goreleaser.darwin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
dist: ./dist
builds:
- binary: fusion
main: ./cmd/server
env:
- CGO_ENABLED=1
goos:
- darwin
goarch:
- amd64
- arm64

archives:
- id: default
format: zip

checksum:
algorithm: sha256
name_template: "darwin_checksums.txt"

snapshot:
name_template: "{{ incpatch .Version }}-next"
27 changes: 27 additions & 0 deletions .goreleaser.linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
dist: ./dist
builds:
- binary: fusion
main: ./cmd/server
env:
# gcc-aarch64-linux-gnu is required
- CGO_ENABLED=1
goos:
- linux
goarch:
- amd64
- arm64
overrides:
- goarch: arm64
env:
- CC=aarch64-linux-gnu-gcc

archives:
- id: default
format: zip

checksum:
algorithm: sha256
name_template: "linux_checksums.txt"

snapshot:
name_template: "{{ incpatch .Version }}-next"
32 changes: 32 additions & 0 deletions .goreleaser.windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
dist: ./dist
builds:
- binary: fusion
main: ./cmd/server
env:
# gcc-mingw-w64 and gcc-multilib are required for windows
- CGO_ENABLED=1
goos:
- windows
goarch:
- amd64
- arm64
overrides:
- goarch: arm64
env:
- CC=aarch64-w64-mingw32-gcc
- CXX=aarch64-w64-mingw32-g++
- goarch: amd64
env:
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++

archives:
- id: default
format: zip

checksum:
algorithm: sha256
name_template: "windows_checksums.txt"

snapshot:
name_template: "{{ incpatch .Version }}-next"
33 changes: 5 additions & 28 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,12 @@
# project_name: fusion
dist: ./build
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- "386"
- arm64
ignore:
- goos: darwin
goarch: "386"
binary: fusion
main: ./cmd/server

archives:
- id: default
format: zip

checksum:
algorithm: sha256
name_template: "checksums.txt"

snapshot:
name_template: "{{ incpatch .Version }}-next"

- skip: true
dist: ./dist
changelog:
use: github

release:
draft: true
extra_files:
- glob: ./dist/*.zip
- glob: ./dist/checksums.txt
Loading

0 comments on commit 1eef55e

Please sign in to comment.