Skip to content

Commit

Permalink
implement build and releasea action
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxtof committed Mar 31, 2022
1 parent 6bd7ca7 commit 974f420
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 1 deletion.
51 changes: 50 additions & 1 deletion .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,53 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."

- name: Checkout
uses: actions/checkout@v2

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

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '^1.17'

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: capi-nutanix
sep-tags: ","
sep-labels: ","
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=sha
- name: Install tools
uses: redhat-actions/openshift-tools-installer@v1
with:
source: "github"
ko: "latest"

- name: Prepare build
run: make test

- name: Build container
env:
KO_DOCKER_REPO: ghcr.io/nutanix-cloud-native/cluster-api-provider-nutanix/controller
TAGS: ${{ steps.meta.outputs.tags }}
LABELS: ${{ steps.meta.outputs.labels }}
PLATFORMS: linux/amd64,linux/arm64,linux/arm
run: |
PTAGS=`echo $TAGS | sed 's/capi-nutanix://g'`
export SOURCE_DATE_EPOCH=$(date +%s)
ko build --bare --image-label "$LABELS" -t "$PTAGS" --platform=$PLATFORMS .
64 changes: 64 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Generate release artefact

on:
push:
tags:
- 'v*.*.*'

jobs:
release_content:
name: Prepare Release release_content
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install tools
uses: redhat-actions/openshift-tools-installer@v1
with:
source: "github"
kustomize: "latest"

- name: build template
run: kustomize build config/default > infrastructure-components.yaml

- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: true
release_name: ${{ github.ref }}
tag_name: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ github.token }}

- name: upload infrastructure-components.yaml
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./infrastructure-components.yaml
asset_name: infrastructure-components.yaml
asset_content_type: application/yaml

- name: upload metadata.yaml
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./metadata.yaml
asset_name: metadata.yaml
asset_content_type: application/yaml

- name: upload cluster-template.yaml
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cluster-template.yaml
asset_name: cluster-template.yaml
asset_content_type: application/yaml

0 comments on commit 974f420

Please sign in to comment.