mirror of
https://github.com/ivuorinen/gibidify.git
synced 2026-01-26 03:24:05 +00:00
66 lines
1.8 KiB
YAML
66 lines
1.8 KiB
YAML
---
|
|
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
|
name: Build and Publish
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
release:
|
|
types: [ created ]
|
|
|
|
permissions: read-all
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Binaries
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
goos: [ "linux", "darwin" ]
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
|
|
with:
|
|
go-version: '1.23'
|
|
|
|
- name: Build binary for ${{ matrix.goos }}
|
|
shell: bash
|
|
run: |
|
|
GOOS=${{ matrix.goos }} GOARCH=amd64 go build \
|
|
-ldflags "-X main.Version=dev-$(date -u +%Y%m%d%H%M)" \
|
|
-o gibidify-${{ matrix.goos }} \
|
|
.
|
|
|
|
- name: Upload artifact for ${{ matrix.goos }}
|
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
|
|
with:
|
|
name: gibidify-${{ matrix.goos }}
|
|
path: gibidify-${{ matrix.goos }}
|
|
|
|
docker:
|
|
name: Build and Publish Docker Image
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'release'
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
|
|
- name: Download Linux binary artifact
|
|
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
|
|
with:
|
|
name: gibidify-linux
|
|
path: .
|
|
|
|
- name: Build Docker image
|
|
shell: bash
|
|
run: |
|
|
cp ./gibidify-linux ./gibidify
|
|
chmod +x ./gibidify
|
|
docker build -t ghcr.io/${{ github.repository }}/gibidify:${{ github.ref_name }} .
|