Skip to content

v1.6.2-flannel1

v1.6.2-flannel1 #56

Workflow file for this run

name: release flannel cni-plugin
on:
# You must provide a tag either via the action input or the git ref (i.e push / create a tag).
# If you do not provide a tag the action will fail.
# If the tag of the release you are creating does not yet exist, you should set
# both the tag and commit action inputs. commit can point to a commit hash or a branch name (ex - main).
# workflow_dispatch:
# inputs:
# branch:
# description: 'Define branch name to run the release GH action against'
# required: true
# default: 'main'
release:
types:
- created
env:
GO_VERSION: "1.23.3"
REPOSITORY: flannel/flannel-cni-plugin
IMAGE_NAME: flannel-io/flannel-cni-plugin
REGISTRY: ghcr.io
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: go mod vendor and tidy
run: make vendor
- name: build all binaries for release
run: make build_all
- name: run tests
run: make test_linux
- name: run go vet
run: go vet
- name: create packages for release
if: success()
run: make release
- name: Upload release files
uses: softprops/action-gh-release@v1
with:
files: |
dist/*
release/*
build-and-push-images:
needs: [build-and-release]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
if: success()
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REPOSITORY }}
flavor: latest=false
tags: |
type=ref,event=tag
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
# if: github.repository_owner == 'flannel-io' && success()
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.image
push: true
platforms: linux/amd64,linux/arm64,linux/arm,linux/s390x,linux/ppc64le,linux/riscv64
tags: ${{ steps.meta.outputs.tags }}
build-and-push-images-github-registry:
needs: [build-and-release]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.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=ref,event=tag
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.image
push: true
platforms: linux/amd64,linux/arm64,linux/arm,linux/s390x,linux/ppc64le,linux/riscv64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: REGISTRY=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true