Files
gibidify/.github/workflows/ci.yml
renovate[bot] 70fede7635 fix(github-action): update actions/upload-artifact (v4.6.0 → v4.6.2) (#28)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-13 19:50:09 +00:00

85 lines
2.1 KiB
YAML

---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build and Publish
# yamllint disable-line rule:truthy
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [created]
permissions: read-all
jobs:
build:
name: Build Binaries
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
actions: write
strategy:
matrix:
goos: ["linux", "darwin"]
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: "./go.mod"
- name: Run go mod tidy
shell: bash
run: go mod tidy
- 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@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: gibidify-${{ matrix.goos }}
path: gibidify-${{ matrix.goos }}
docker:
name: Build and Publish Docker Image
if: github.event_name == 'release'
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
actions: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download Linux binary artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
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 }} .