diff --git a/.github/workflows/release-binary.yml b/.github/workflows/release-binary.yml index 444275e2..b41b1412 100644 --- a/.github/workflows/release-binary.yml +++ b/.github/workflows/release-binary.yml @@ -7,7 +7,28 @@ on: workflow_dispatch: jobs: - release: + build-mac: + runs-on: macos-latest + steps: + - name: "Check out code" + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: "Set up Go" + uses: actions/setup-go@v4 + with: + go-version: 1.20.x + cache: true + + - name: "Create release on GitHub" + uses: goreleaser/goreleaser-action@v4 + with: + args: "release -f .goreleaser/mac.yml --clean" + version: latest + workdir: . + + build-linux: runs-on: ubuntu-latest-16-cores steps: - name: "Check out code" @@ -24,7 +45,28 @@ jobs: - name: "Create release on GitHub" uses: goreleaser/goreleaser-action@v4 with: - args: "release --rm-dist" + args: "release -f .goreleaser/linux.yml --clean" + version: latest + workdir: . + + build-windows: + runs-on: windows-latest-8-cores + steps: + - name: "Check out code" + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: "Set up Go" + uses: actions/setup-go@v4 + with: + go-version: 1.20.x + cache: true + + - name: "Create release on GitHub" + uses: goreleaser/goreleaser-action@v4 + with: + args: "release -f .goreleaser/windows.yml --clean" version: latest workdir: . env: diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml index c67b783e..80b38207 100644 --- a/.github/workflows/release-test.yml +++ b/.github/workflows/release-test.yml @@ -3,13 +3,58 @@ name: 🔨 Release Test on: pull_request: paths: + - '**.yml' - '**.go' - '**.mod' workflow_dispatch: jobs: - release-test: + release-test-mac: + runs-on: macos-latest + steps: + - name: "Check out code" + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: 1.20.x + + - name: release test + uses: goreleaser/goreleaser-action@v4 + with: + args: "release -f .goreleaser/mac.yml --clean --snapshot" + version: latest + workdir: . + + release-test-linux: runs-on: ubuntu-latest-16-cores + steps: + - name: "Check out code" + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: 1.20.x + + # todo: musl compatible? + - name: Install Dependences + run: sudo apt install gcc-aarch64-linux-gnu + + - name: release test + uses: goreleaser/goreleaser-action@v4 + with: + args: "release -f .goreleaser/linux.yml --clean --snapshot" + version: latest + workdir: . + + release-test-windows: + runs-on: windows-latest-8-cores steps: - name: "Check out code" uses: actions/checkout@v3 @@ -24,6 +69,6 @@ jobs: - name: release test uses: goreleaser/goreleaser-action@v4 with: - args: "release --clean --snapshot" + args: "release -f .goreleaser/windows.yml --clean --snapshot" version: latest - workdir: . \ No newline at end of file + workdir: . diff --git a/.gitignore b/.gitignore index cfb9d110..1aae5fa9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ cmd/katana/katana katana *.exe katana_*/ -katana_*/ \ No newline at end of file +katana_*/ +dist/ \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml deleted file mode 100644 index a1e71ae6..00000000 --- a/.goreleaser.yml +++ /dev/null @@ -1,45 +0,0 @@ -before: - hooks: - - go mod tidy - -builds: -- env: - - CGO_ENABLED=0 - goos: - - windows - - linux - - darwin - goarch: - - amd64 - - 386 - - arm - - arm64 - - ignore: - - goos: darwin - goarch: '386' - - goos: windows - goarch: 'arm' - - goos: windows - goarch: 'arm64' - - binary: '{{ .ProjectName }}' - main: cmd/katana/main.go - -archives: -- format: zip - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ if eq .Os "darwin" }}macOS{{ else }}{{ .Os }}{{ end }}_{{ .Arch }}' - -checksum: - algorithm: sha256 - -announce: - slack: - enabled: true - channel: '#release' - username: GoReleaser - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' - - discord: - enabled: true - message_template: '**New Release: {{ .ProjectName }} {{.Tag}}** is published! Check it out at {{ .ReleaseURL }}' \ No newline at end of file diff --git a/.goreleaser/linux.yml b/.goreleaser/linux.yml new file mode 100644 index 00000000..1a68315e --- /dev/null +++ b/.goreleaser/linux.yml @@ -0,0 +1,48 @@ +env: + - GO111MODULE=on +before: + hooks: + - go mod tidy +project_name: katana +builds: + - id: katana-linux-generic + ldflags: + - -s -w + binary: katana + env: + - CGO_ENABLED=1 + main: ./cmd/katana/main.go + goos: + - linux + goarch: + - amd64 + + - id: katana-linux-arm + ldflags: + - -s -w + binary: katana + env: + - CGO_ENABLED=1 + - CC=aarch64-linux-gnu-gcc + main: ./cmd/katana/main.go + goos: + - linux + goarch: + - arm64 + +archives: +- format: zip + +checksum: + name_template: "{{ .ProjectName }}-linux-checksums.txt" + +announce: + slack: + enabled: true + channel: '#release' + username: GoReleaser + message_template: 'New Release: {{ .ProjectName }} {{.Tag}} is published! Check it out at {{ .ReleaseURL }}' + + discord: + enabled: true + message_template: '**New Release: {{ .ProjectName }} {{.Tag}}** is published! Check it out at {{ .ReleaseURL }}' \ No newline at end of file diff --git a/.goreleaser/mac.yml b/.goreleaser/mac.yml new file mode 100644 index 00000000..53b240a5 --- /dev/null +++ b/.goreleaser/mac.yml @@ -0,0 +1,28 @@ +env: + - GO111MODULE=on +before: + hooks: + - go mod tidy +project_name: katana +builds: + - id: katana-darwin + ldflags: + - -s -w + binary: katana + env: + - CGO_ENABLED=1 + main: ./cmd/katana/main.go + goos: + - darwin + goarch: + - amd64 + - arm64 + - 386 + - arm + +archives: +- format: zip + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ if eq .Os "darwin" }}macOS{{ else }}{{ .Os }}{{ end }}_{{ .Arch }}' + +checksum: + name_template: "{{ .ProjectName }}-mac-checksums.txt" diff --git a/.goreleaser/windows.yml b/.goreleaser/windows.yml new file mode 100644 index 00000000..f2b1448d --- /dev/null +++ b/.goreleaser/windows.yml @@ -0,0 +1,24 @@ +env: + - GO111MODULE=on +before: + hooks: + - go mod tidy +project_name: katana +builds: + - id: katana-windows + ldflags: + - -s -w + binary: katana + env: + - CGO_ENABLED=1 + main: ./cmd/katana/main.go + goos: + - windows + goarch: + - amd64 + +archives: +- format: zip + +checksum: + name_template: "{{ .ProjectName }}-windows-checksums.txt"