Skip to content

Commit

Permalink
Update github actions for releasing manifests and images
Browse files Browse the repository at this point in the history
  Images are pushed to ghcr.io as part of release.

Signed-off-by: Parth Yadav <[email protected]>
  • Loading branch information
parthyadav3105 committed Sep 5, 2024
1 parent d95384c commit fc619a6
Show file tree
Hide file tree
Showing 19 changed files with 144 additions and 82 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/build-bundle-on-release.yaml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/release-byoh-controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release BYOH controller

# on:
# push:
# # Build and publish artifacts when new tag is created for release
# tags:
# - "v*.*.*"

on:
push:
branches: [ main ]

jobs:
build-and-publish-byoh-controller:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Login to GitHub Container Registry (ghcr.io)
env:
DOCKER_USER: ${{ github.repository_owner }}
DOCKER_PWD: ${{ secrets.GITHUB_TOKEN }}
run: docker login -u $DOCKER_USER -p $DOCKER_PWD ghcr.io

# - name: pre-cleanup the docker
# run: sudo docker system prune -a -f && sudo docker buildx prune

# - name: build and push controller image
# env:
# REPO: ${{ github.repository_owner }}
# TAG: ${{ github.ref_name }}
# run: |
# IMG=ghcr.io/$REPO/cluster-api-byoh-controller:$TAG make docker-build
# docker push ghcr.io/$REPO/cluster-api-byoh-controller:$TAG

- name: Make the image public via GitHub API
env:
REPO: ${{ github.repository_owner }}
TAG: ${{ github.ref_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -X GET \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/orgs/${{ github.repository_owner }}/packages/container/cluster-api-byoh-controller?tag=v0.5.1 \
-d '{"visibility":"public"}'
64 changes: 64 additions & 0 deletions .github/workflows/release-k8s-byoh-bundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release k8s BYOH Bundles

on:
push:
# Build and publish artifacts when new tag is created for release
tags:
- "v*.*.*"

jobs:
build-and-publish-k8s-bundles:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Login to GitHub Container Registry (ghcr.io)
env:
DOCKER_USER: ${{ github.repository_owner }}
DOCKER_PWD: ${{ secrets.GITHUB_TOKEN }}
run: docker login -u $DOCKER_USER -p $DOCKER_PWD ghcr.io

- name: pre-cleanup the docker
run: sudo docker system prune -a -f && sudo docker buildx prune

- name: Build BYOH Ingredients Docker image
run: |
cd installer/bundle_builder/ingredients/deb/
docker build -t byoh-ingredients-deb .
- name: Create BYOH Ingredients directory and download files
run: |
mkdir -p byoh-ingredients-download
docker run --rm -v ${{ github.workspace }}/byoh-ingredients-download:/ingredients byoh-ingredients-deb
- name: Build BYOH Bundle Docker image
run: |
cd installer/bundle_builder/
docker build -t byoh-build-push-bundle .
- name: Build and Publish BYOH Bundle
env:
BUILD_ONLY: 0
REPO: ${{ github.repository_owner }}
BUNDLE_NAME: byoh-bundle-ubuntu_20.04.1_x86-64_k8s
TAG: v1.31.0
run: |
docker run --rm -v ~/.docker/config.json:/root/.docker/config.json -v ${{ github.workspace }}/byoh-ingredients-download:/ingredients --env BUILD_ONLY=${{ env.BUILD_ONLY }} byoh-build-push-bundle ghcr.io/$REPO/$BUNDLE_NAME:$TAG
- name: Cleanup Docker
run: sudo docker logout && sudo docker system prune -a -f && sudo docker buildx prune

- name: Make the image public via GitHub API
env:
REPO: ${{ github.repository_owner }}
BUNDLE_NAME: byoh-bundle-ubuntu_20.04.1_x86-64_k8s
TAG: v1.31.0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
IMAGE_URL="ghcr.io/$REPO/$BUNDLE_NAME"
curl -X PATCH \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/orgs/${{ github.repository_owner }}/packages/container/$BUNDLE_NAME/versions/latest \
-d '{"visibility":"public"}'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Draft Release
name: Release

on:
push:
Expand All @@ -20,7 +20,7 @@ jobs:
go-version: 1.20.7

- name: Build Release Artifacts
run: IMG="coredgeio/cluster-api-byoh-controller:${{ github.ref_name }}" make build-release-artifacts
run: IMG="ghcr.io/coredgeio/cluster-api-byoh-controller:${{ github.ref_name }}" make build-release-artifacts

- name: Publish Release
uses: softprops/action-gh-release@v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
variables:
- name: bundleLookupBaseRegistry
value: "coredgeio"
value: "ghcr.io/coredgeio"
- name: controlPlaneIpAddr
value: ${CONTROL_PLANE_ENDPOINT_IP}
- name: kubeVipPodManifest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ kind: ByoCluster
metadata:
name: ${CLUSTER_NAME}
spec:
bundleLookupBaseRegistry: coredge
bundleLookupBaseRegistry: ghcr.io/coredgeio
controlPlaneEndpoint:
host: ${CONTROL_PLANE_ENDPOINT_IP}
port: 6443
Expand Down Expand Up @@ -203,7 +203,7 @@ metadata:
spec:
template:
spec:
bundleRepo: coredge
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
Expand All @@ -213,5 +213,5 @@ metadata:
spec:
template:
spec:
bundleRepo: coredge
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ kind: ByoCluster
metadata:
name: ${CLUSTER_NAME}
spec:
bundleLookupBaseRegistry: coredgeio
bundleLookupBaseRegistry: ghcr.io/coredgeio
controlPlaneEndpoint:
host: ${CONTROL_PLANE_ENDPOINT_IP}
port: 6443
Expand Down Expand Up @@ -145,5 +145,5 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
schema:
openAPIV3Schema:
type: string
default: "coredgeio"
default: "ghcr.io/coredgeio"
- name: controlPlaneIpAddr
required: true
schema:
Expand Down Expand Up @@ -157,7 +157,7 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
Expand Down Expand Up @@ -189,7 +189,7 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
variables:
- name: bundleLookupBaseRegistry
value: "coredgeio"
value: "ghcr.io/coredgeio"
- name: controlPlaneIpAddr
value: ${CONTROL_PLANE_ENDPOINT_IP}
- name: kubeVipPodManifest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ kind: ByoCluster
metadata:
name: ${CLUSTER_NAME}
spec:
bundleLookupBaseRegistry: coredgeio
bundleLookupBaseRegistry: ghcr.io/coredgeio
controlPlaneEndpoint:
host: ${CONTROL_PLANE_ENDPOINT_IP}
port: 6443
Expand Down Expand Up @@ -226,7 +226,7 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
Expand All @@ -236,5 +236,5 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ kind: ByoCluster
metadata:
name: ${CLUSTER_NAME}
spec:
bundleLookupBaseRegistry: coredgeio
bundleLookupBaseRegistry: ghcr.io/coredgeio
controlPlaneEndpoint:
host: ${CONTROL_PLANE_ENDPOINT_IP}
port: 6443
Expand Down Expand Up @@ -148,5 +148,5 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
schema:
openAPIV3Schema:
type: string
default: "coredgeio"
default: "ghcr.io/coredgeio"
- name: controlPlaneIpAddr
required: true
schema:
Expand Down Expand Up @@ -155,7 +155,7 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
Expand Down Expand Up @@ -199,7 +199,7 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
---
apiVersion: v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
variables:
- name: bundleLookupBaseRegistry
value: "coredgeio"
value: "ghcr.io/coredgeio"
- name: controlPlaneIpAddr
value: ${CONTROL_PLANE_ENDPOINT_IP}
- name: kubeVipPodManifest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ kind: ByoCluster
metadata:
name: ${CLUSTER_NAME}
spec:
bundleLookupBaseRegistry: coredgeio
bundleLookupBaseRegistry: ghcr.io/coredgeio
controlPlaneEndpoint:
host: ${CONTROL_PLANE_ENDPOINT_IP}
port: 6443
Expand Down Expand Up @@ -195,7 +195,7 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
Expand All @@ -205,5 +205,5 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ kind: ByoCluster
metadata:
name: ${CLUSTER_NAME}
spec:
bundleLookupBaseRegistry: coredgeio
bundleLookupBaseRegistry: ghcr.io/coredgeio
controlPlaneEndpoint:
host: ${CONTROL_PLANE_ENDPOINT_IP}
port: 6443
Expand Down Expand Up @@ -142,5 +142,5 @@ metadata:
spec:
template:
spec:
bundleRepo: coredgeio
bundleRepo: ghcr.io/coredgeio
bundleType: k8s
Loading

0 comments on commit fc619a6

Please sign in to comment.