Skip to content

Commit

Permalink
M #-: Add "Release" GA workflow (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
sk4zuzu authored Feb 5, 2025
1 parent e39d2d0 commit 84637c8
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Release

on:
push:
tags: ["v*.*.*"]

permissions:
contents: write
packages: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"

- name: Build image
run: docker build . --tag "ghcr.io/${GITHUB_REPOSITORY,,}:$GITHUB_REF_NAME"

- name: Push image
run: docker push "ghcr.io/${GITHUB_REPOSITORY,,}:$GITHUB_REF_NAME"

- name: Tag image (latest)
run: docker tag "ghcr.io/${GITHUB_REPOSITORY,,}:$GITHUB_REF_NAME" "ghcr.io/${GITHUB_REPOSITORY,,}:latest"

- name: Push image (latest)
run: docker push "ghcr.io/${GITHUB_REPOSITORY,,}:latest"

- name: Generate manifests
run: make release "CLOSEST_TAG:=$GITHUB_REF_NAME"

- name: Create release
env: { GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" }
run: gh release create "$GITHUB_REF_NAME" --generate-notes "_releases/$GITHUB_REF_NAME"/*.yaml
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ ifndef ignore-not-found
ignore-not-found = false
endif

.PHONY: install uninstall deploy undeploy logs ctlptl-apply ctlptl-delete clusterctl-init one-apply one-delete one-flannel
.PHONY: install uninstall deploy undeploy logs ctlptl-apply ctlptl-delete \
clusterctl-init clusterctl-init-full one-apply one-delete one-flannel

install: manifests $(KUSTOMIZE) $(KUBECTL) # Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f-
Expand Down Expand Up @@ -175,6 +176,9 @@ ctlptl-delete: $(CTLPTL) $(KIND)
clusterctl-init: $(CLUSTERCTL)
$(CLUSTERCTL) init

clusterctl-init-full: $(CLUSTERCTL)
$(CLUSTERCTL) init --config=clusterctl-config.yaml --infrastructure=opennebula:$(CLOSEST_TAG)

one-apply: $(KUSTOMIZE) $(ENVSUBST) $(KUBECTL)
$(KUSTOMIZE) build kustomize/v1beta1/default-dev | $(ENVSUBST) | $(KUBECTL) apply -f-

Expand Down
4 changes: 4 additions & 0 deletions clusterctl-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
providers:
- name: opennebula
type: InfrastructureProvider
url: "https://github.com/OpenNebula/cluster-api-provider-opennebula/releases/download/latest/infrastructure-components.yaml"

0 comments on commit 84637c8

Please sign in to comment.