Skip to content

Uploaded demo thumbnail #45

Uploaded demo thumbnail

Uploaded demo thumbnail #45

name: Build and Release
on:
push:
pull_request:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Windows builds always use linux/amd64 platform
- os: windows
arch: 386
dockerfile: ./docker/Dockerfile.windows.386
artifact: nomi-cli.zip
platform: linux/amd64
- os: windows
arch: amd64
dockerfile: ./docker/Dockerfile.windows.amd64
artifact: nomi-cli.zip
platform: linux/amd64
# Linux builds with specific architectures
- os: linux
arch: 386
dockerfile: ./docker/Dockerfile.linux.386
artifact: nomi-cli
platform: linux/amd64
- os: linux
arch: amd64
dockerfile: ./docker/Dockerfile.linux.amd64
artifact: nomi-cli
platform: linux/amd64
- os: linux
arch: arm64
dockerfile: ./docker/Dockerfile.linux.arm64
artifact: nomi-cli
platform: linux/arm64
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.platform }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set Build Version and Date
run: |
echo "BUILD_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: Build with Docker
run: |
docker buildx build \
--platform ${{ matrix.platform }} \
-f ${{ matrix.dockerfile }} \
-t nomi-cli-${{ matrix.os }}-${{ matrix.arch }} \
--build-arg BUILD_VERSION=${{ env.BUILD_VERSION }} \
--build-arg BUILD_DATE=${{ env.BUILD_DATE }} \
--output type=local,dest=build \
.
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: nomi-cli-${{ matrix.os }}-${{ matrix.arch }}
path: build/app/${{ matrix.artifact }}
build-darwin-arm64:
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install Dependencies
run: bash hack/install-deps.sh
- name: Build Binary on Linux and macOS
shell: bash
env:
CGO_ENABLED: 1
run: |
go build \
-ldflags "-X main.buildDate=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
-X main.buildVersion=${{ github.ref_name }}" \
-o nomi-cli ./cmd/cli
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: nomi-cli-darwin-arm64
path: nomi-cli
release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: [build, build-darwin-arm64]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: nomi-cli-windows-amd64
path: artifacts/windows-amd64
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: nomi-cli-windows-386
path: artifacts/windows-386
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: nomi-cli-linux-amd64
path: artifacts/linux-amd64
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: nomi-cli-linux-386
path: artifacts/linux-386
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: nomi-cli-linux-arm64
path: artifacts/linux-arm64
- name: Download Darwin ARM64 Artifact
uses: actions/download-artifact@v4
with:
name: nomi-cli-darwin-arm64
path: artifacts/darwin-arm64
- name: Move Artifacts
run: |
mv artifacts/darwin-arm64/nomi-cli artifacts/darwin-arm64/nomi-cli-darwin-arm64
mv artifacts/linux-arm64/nomi-cli artifacts/linux-arm64/nomi-cli-linux-arm64
mv artifacts/linux-386/nomi-cli artifacts/linux-386/nomi-cli-linux-386
mv artifacts/linux-amd64/nomi-cli artifacts/linux-amd64/nomi-cli-linux-amd64
mv artifacts/windows-386/nomi-cli.zip artifacts/windows-386/nomi-cli-windows-386.zip
mv artifacts/windows-amd64/nomi-cli.zip artifacts/windows-amd64/nomi-cli-windows-amd64.zip
- uses: release-drafter/release-drafter@v5
with:
config-name: default
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/windows-amd64/nomi-cli-windows-amd64.zip
artifacts/windows-386/nomi-cli-windows-386.zip
artifacts/linux-amd64/nomi-cli-linux-amd64
artifacts/linux-386/nomi-cli-linux-386
artifacts/linux-arm64/nomi-cli-linux-arm64
artifacts/darwin-arm64/nomi-cli-darwin-arm64
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: false