Skip to content

📝 docs(diagrams): add detailed architecture diagrams #128

📝 docs(diagrams): add detailed architecture diagrams

📝 docs(diagrams): add detailed architecture diagrams #128

Workflow file for this run

name: Build and Push Production Docker Image
on:
push:
branches: [ main ]
# Optionally trigger on tags for releases
tags: [ 'v*' ]
# Allow manual triggering with version input
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g., v1.0.0)'
required: true
default: 'v1.0.0'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
# Using github.token directly to avoid any permission issues
# Note: IDE may show false positive warnings about GH_TOKEN
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: write # Needed for creating releases
packages: write
# Add additional permissions for package management
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
check-latest: true
# Add Go module caching
- name: Go Module Cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
env:
GOTOOLCHAIN: auto
- name: Check Go version in Dockerfile and go.mod
run: |
echo "Checking Go version in Dockerfile..."
GO_VERSION_DOCKERFILE=$(grep "FROM golang:" Dockerfile | head -1 | cut -d':' -f2 | cut -d'-' -f1)
echo "Go version in Dockerfile: $GO_VERSION_DOCKERFILE"
echo "Checking Go version in go.mod..."
GO_VERSION_GOMOD=$(grep "^go " go.mod | awk '{print $2}')
echo "Go version in go.mod: $GO_VERSION_GOMOD"
if [[ "$GO_VERSION_DOCKERFILE" != "$GO_VERSION_GOMOD" ]]; then
echo "Warning: Go version mismatch between Dockerfile ($GO_VERSION_DOCKERFILE) and go.mod ($GO_VERSION_GOMOD)"
fi
echo "GOTOOLCHAIN environment variable is set to: $GOTOOLCHAIN"
env:
GOTOOLCHAIN: auto
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
# Using github.token directly (IDE may show false positive warning)
password: ${{ github.token }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ github.event.inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
env:
DOCKER_BUILDKIT: 1
GOTOOLCHAIN: auto
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GOTOOLCHAIN=auto
SKIP_TESTS=true
SKIP_UPX=false
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}
platforms: linux/amd64
provenance: false
- name: Display manual instructions for making package public
run: |
echo "::warning::To make your package public, please follow these steps:"
echo "::warning::1. Go to https://github.com/${{ github.repository }}/pkgs/container/aws-multi-eni-controller"
echo "::warning::2. Click on Package settings (⚙️ icon) at the bottom of the page"
echo "::warning::3. Under 'Danger Zone', click 'Change visibility'"
echo "::warning::4. Select 'Public' and confirm"
- name: Create GitHub Release
if: github.event_name == 'workflow_dispatch'
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.event.inputs.version }}
tag_name: ${{ github.event.inputs.version }}
generate_release_notes: true
draft: false
prerelease: false
# Using github.token directly (IDE may show false positive warning)
token: ${{ github.token }}