Skip to content

Merge pull request #5 from svalabs/dependabot/go_modules/k8s.io/clien… #24

Merge pull request #5 from svalabs/dependabot/go_modules/k8s.io/clien…

Merge pull request #5 from svalabs/dependabot/go_modules/k8s.io/clien… #24

Workflow file for this run

name: Build and Release
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20.x'
# Setup Go
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
# Install dependencies for semantic-release
- name: Install dependencies
run: npm install
# Cross-compile binaries for multiple architectures
- name: Cross-compile binaries
run: |
mkdir -p release
GOARCHES=("amd64" "arm64")
for arch in "${GOARCHES[@]}"; do
mkdir -p release/linux_$arch/
CGO_ENABLED=0 GOARCH=$arch GOOS=linux go build -o release/linux_$arch/kubermatic-argocd-bridge ./cmd
gzip -c release/linux_$arch/kubermatic-argocd-bridge > release/kubermatic-argocd-bridge_linux_$arch.gz
done
sha256sum release/*.gz > release/checksums.txt
# Build Docker images for multiple architectures using buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: 'ghcr.io'
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
run: |
docker buildx create --use
docker buildx build -f Dockerfile.release --platform linux/amd64,linux/arm64 \
-t ghcr.io/svalabs/kubermatic-argocd-bridge:${{ github.sha }} \
-t ghcr.io/svalabs/kubermatic-argocd-bridge:latest \
-f Dockerfile.release \
--push .
# Create GitHub release with semantic-release
- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
REGISTRY_USER: ${{ github.actor }}
SOURCE_TAG: ${{ github.sha }}
REGISTRY_URL: 'ghcr.io'
REGISTRY_IMAGE: 'svalabs/kubermatic-argocd-bridge'
run: npx semantic-release