Skip to content

Commit

Permalink
build: linux/darwin amd64 only
Browse files Browse the repository at this point in the history
  • Loading branch information
nalgeon committed Apr 7, 2024
1 parent 99708d7 commit a0948b4
Showing 1 changed file with 60 additions and 14 deletions.
74 changes: 60 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,73 @@ permissions:
contents: write

jobs:
publish:
runs-on: ubuntu-latest
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
goos: linux
asset_name: redka_linux_amd64.zip
- os: macos-latest
goos: darwin
asset_name: redka_darwin_amd64.zip
steps:
- name: Checkout
- name: Check out code
uses: actions/checkout@v4

- name: Setup Go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "stable"

- name: Install dependencies
- name: Build binary
run: GOOS=${{ matrix.goos }} make build

- name: Zip the binary
run: zip ${{ matrix.asset_name }} redka

- name: Pack production binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.asset_name }}

checksum:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts/

- name: Generate checksums
run: |
sudo apt-get update
sudo apt-get install -y libsqlite3-dev
go get .
cd artifacts
sha256sum * > checksums.txt
- name: Upload checksums file
uses: actions/upload-artifact@v3
with:
name: checksums
path: artifacts/checksums.txt

release:
needs: checksum
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: release/

- name: Release and publish
uses: goreleaser/goreleaser-action@v4
- name: Upload assets to release
uses: svenstaro/upload-release-action@v2
with:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CGO_ENABLED: "1"
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release/*
file_glob: true
tag: ${{ github.ref }}

0 comments on commit a0948b4

Please sign in to comment.