Skip to content

Commit

Permalink
Test build on PR so renovate can auto-release
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Manuel "Kang" Perez committed Jan 16, 2024
1 parent 06c81ca commit e0bca30
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 12 deletions.
49 changes: 37 additions & 12 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
name: Image creation and publishing
on:
push:
tags:
- "*"
branches:
- main
- renovate/**
pull_request:

permissions:
contents: write
packages: write

jobs:
get-version:
name: Get Cilium version
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Generate tag
id: tag
run: |
CILIUM_CHECKSUM=$(grep -E 'github.com/cilium/cilium v[0-9]*\.[0-9]*\.[0-9]* h1:.*' go.sum)
CILIUM_VERSION=$(sed -s 's|github.com/cilium/cilium v\([0-9]*\.[0-9]*\.[0-9]*\) h1:.*|\1|' <<<"${CILIUM_CHECKSUM}")
echo "CILIUM_VERSION=${CILIUM_VERSION}" >> "$GITHUB_OUTPUT"
outputs:
tag: ${{ steps.tag.outputs.CILIUM_VERSION }}

build:
name: Push to registry
runs-on: ubuntu-latest
name: Build and push to registry
runs-on: ubuntu-22.04
needs: [get-version]
steps:
- uses: actions/checkout@v4
- name: Patch this repo so goreleaser thinks is tagged
run: |
git tag ${{ needs.get-version.outputs.tag }}
- uses: actions/setup-go@v5
with:
go-version: '1.17'

go-version-file: go.mod
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
driver-opts: |
image=moby/buildkit:master
network=host

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -33,10 +48,20 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run GoReleaser in dry run-mode
if: startsWith(github.ref, 'refs/heads/main') == false
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: build --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run GoReleaser
if: startsWith(github.ref, 'refs/heads/main') == true
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --rm-dist
args: release --rm-dist --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59 changes: 59 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ snapshot:
changelog:
skip: true

release:
disable: true

dockers:
- goarch: 386
use: buildx
Expand All @@ -33,6 +36,11 @@ dockers:
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-386"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-386"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-386"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}-386"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}-{{ .ShortCommit }}-386"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-{{ .ShortCommit }}-386"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-{{ .ShortCommit }}-386"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-{{ .ShortCommit }}-386"
build_flag_templates:
- "--platform=linux/386"
- "--build-arg=BINARY_NAME={{ .ProjectName }}"
Expand All @@ -49,6 +57,11 @@ dockers:
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}-{{ .ShortCommit }}-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-{{ .ShortCommit }}-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-{{ .ShortCommit }}-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-{{ .ShortCommit }}-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--build-arg=BINARY_NAME={{ .ProjectName }}"
Expand All @@ -66,6 +79,11 @@ dockers:
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}-{{ .ShortCommit }}-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-{{ .ShortCommit }}-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-{{ .ShortCommit }}-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-{{ .ShortCommit }}-arm"
build_flag_templates:
- "--platform=linux/arm"
- "--build-arg=BINARY_NAME={{ .ProjectName }}"
Expand All @@ -82,6 +100,11 @@ dockers:
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-arm64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-arm64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-arm64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}-arm64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}-{{ .ShortCommit }}-arm64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-{{ .ShortCommit }}-arm64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-{{ .ShortCommit }}-arm64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-{{ .ShortCommit }}-arm64"
build_flag_templates:
- "--platform=linux/arm64"
- "--build-arg=BINARY_NAME={{ .ProjectName }}"
Expand Down Expand Up @@ -125,3 +148,39 @@ docker_manifests:
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-arm64"


- name_template: "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}"
image_templates:
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}-386"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}-arm64"

- name_template: "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}-{{ .ShortCommit }}"
image_templates:
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}-{{ .ShortCommit }}-386"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}-{{ .ShortCommit }}-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}-{{ .ShortCommit }}-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}-{{ .ShortCommit }}-arm64"

- name_template: "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-{{ .ShortCommit }}"
image_templates:
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-{{ .ShortCommit }}-386"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-{{ .ShortCommit }}-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-{{ .ShortCommit }}-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}-{{ .ShortCommit }}-arm64"

- name_template: "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-{{ .ShortCommit }}"
image_templates:
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-{{ .ShortCommit }}-386"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-{{ .ShortCommit }}-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-{{ .ShortCommit }}-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-{{ .ShortCommit }}-arm64"

- name_template: "ghcr.io/kang-makes/{{ .ProjectName }}:latest-{{ .ShortCommit }}"
image_templates:
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-{{ .ShortCommit }}-386"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-{{ .ShortCommit }}-amd64"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-{{ .ShortCommit }}-arm"
- "ghcr.io/kang-makes/{{ .ProjectName }}:latest-{{ .ShortCommit }}-arm64"

0 comments on commit e0bca30

Please sign in to comment.