Skip to content

Twitch Example + Build Env Vars #5

Twitch Example + Build Env Vars

Twitch Example + Build Env Vars #5

name: Test
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
id-token: write
contents: write
packages: write
jobs:
build:
name: Build
runs-on: ubuntu-latest
container:
image: ghcr.io/vanilla-os/pico:main
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
# Unit tests (if/when they exist)
# - name: Run Unit Tests
# run: go test -v ./...
- name: Build Application
run: go build -o rfw -ldflags="-X 'main.Version=${{ github.sha }}'" ./cmd/rfw/main.go
- name: Calculate and Save Checksums
run: sha256sum rfw > checksums.txt
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: rfw-build
path: |
rfw
checksums.txt
image:
if: ${{ !contains(github.event.head_commit.message, '(skip)') }}
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Set variables
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate image name and tags
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/rfwlab/rfw
tags: |
type=ref,event=branch
type=sha
type=ref,event=tag
- name: Build and push the Docker image
id: build
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
build-args: |
BUILD_TYPE=Debug