Skip to content

Add Config Hydration (#19) #45

Add Config Hydration (#19)

Add Config Hydration (#19) #45

Workflow file for this run

name: static-server
on:
pull_request:
branches: [ main,development ]
push:
tags:
- 'v*'
jobs:
test_and_build:
runs-on: ubuntu-latest
name: Test and Build
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.26'
- name: Test
run: go test ./...
code_quality:
name: Code Quality🎖️
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.26'
- uses: golangci/golangci-lint-action@v9
with:
version: v2.10.1
args: --timeout 9m0s
check_docker_config:
if: ${{ startsWith(github.ref, 'refs/tags/v')}}
runs-on: ubuntu-latest
name: Check Docker Config
outputs:
configured: ${{ steps.check.outputs.configured }}
steps:
- name: Check Docker configuration
id: check
run: |
if [ -z "${{ vars.DOCKER_USERNAME }}" ]; then
echo "::warning::DOCKER_USERNAME variable is not set - skipping Docker push"
exit 0
fi
if [ -z "${{ vars.DOCKER_REGISTRY_TARGET }}" ]; then
echo "::warning::DOCKER_REGISTRY_TARGET variable is not set - skipping Docker push"
exit 0
fi
if [ -z "${{ secrets.DOCKER_HUB_PAT }}" ]; then
echo "::warning::DOCKER_HUB_PAT secret is not set - skipping Docker push"
exit 0
fi
echo "configured=true" >> $GITHUB_OUTPUT
release_package:
if: ${{ needs.check_docker_config.outputs.configured == 'true' }}
needs: [test_and_build, code_quality, check_docker_config]
runs-on: ubuntu-latest
name: Release Package
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PAT }}
- name: Extract Release Tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: docker/build-push-action@v6
with:
push: true
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
provenance: true
sbom: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ vars.DOCKER_REGISTRY_TARGET }}:${{ env.RELEASE_VERSION }}
- name: Output Image Path
run: echo "Image pushed to ${{ vars.DOCKER_REGISTRY_TARGET }}:${{ env.RELEASE_VERSION }}"