Adding artifact names #94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
branches: | |
- "main" | |
- "v[0-9]+.[0-9]+" | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
- "v[0-9]+.[0-9]+" | |
jobs: | |
main: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
go: ["1.20"] | |
name: Go ${{ matrix.go }} | |
steps: | |
- name: Checkout Metal LB Operator | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Fetch all history for all tags and branches | |
- uses: actions/setup-go@v2 | |
id: go | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Verify modules | |
run: go mod verify | |
- name: Verify format | |
run: | | |
make fmt | |
git diff --exit-code | |
- name: Verify release bundle manifests | |
run: | | |
make bundle-release | |
git diff --exit-code -I'^ createdAt: ' bundle | |
- name: Create and set up K8s Kind Cluster | |
run: | | |
./hack/kind-cluster-with-registry.sh | |
make deploy-olm | |
- name: Build bundle image | |
run: | | |
make build-and-push-bundle-images REPO=localhost:5000 | |
- name: Deploy Metal LB Operator with OLM | |
run: | | |
make deploy-with-olm REPO=localhost:5000 | |
- name: E2E Tests | |
run: | | |
export KUBECONFIG=${HOME}/.kube/config | |
make test-validation | |
SKIP="frr-k8s" make test-e2e | |
- name: Archive E2E Tests logs | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: test_e2e_logs | |
path: /tmp/test_e2e_logs/ | |
- name: Export kind logs | |
if: ${{ failure() }} | |
run: | | |
kind export logs /tmp/kind_logs | |
- name: Archive kind logs | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: kind_logs | |
path: /tmp/kind_logs | |
publish-image: | |
needs: [main] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Code checkout | |
uses: actions/checkout@v3 | |
- name: Setup docker buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log into Quay | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USER }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
quay.io/metallb/metallb-operator | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{raw}} | |
labels: | | |
org.opencontainers.image.title=metallboperator | |
org.opencontainers.image.description=operator for metallb, a network load-balancer implementation for Kubernetes using standard routing protocols | |
- name: Build and push metallboperator | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le,linux/arm/v7 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: true | |
build-args: | | |
GIT_BRANCH: ${{ github.ref_name }} | |
GIT_COMMIT: ${{ github.sha }} | |
release: | |
needs: [publish-image] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') # we craft releases only for tags | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Build changelog | |
id: build_changelog | |
uses: mikepenz/release-changelog-builder-action@main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body: ${{steps.build_changelog.outputs.changelog}} | |
draft: false | |
prerelease: false |