Skip to content

Commit

Permalink
create nightly builds
Browse files Browse the repository at this point in the history
Signed-off-by: omrishiv <[email protected]>
  • Loading branch information
omrishiv committed Jun 20, 2024
1 parent 9d3bdfa commit e454aed
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 5 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: nightly
on:
# This can be used to automatically publish nightlies at UTC nighttime
schedule:
- cron: '0 7 * * *' # run at 7 AM UTC
# This can be used to allow manually triggering nightlies from the web interface
workflow_dispatch:

jobs:
nightly:
runs-on: ubuntu-22.04
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.CNOE_GH_WORKFLOW_TOKEN_APP_ID }}
private-key: ${{ secrets.CNOE_GH_WORKFLOW_TOKEN_PRIVATE_KEY }}
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: ${{ steps.generate-token.outputs.token }}
fetch-depth: 0

- run: git fetch --force --tags
-
name: 'Push new tag'
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
# A previous release was created using a lightweight tag
# git describe by default includes only annotated tags
# git describe --tags includes lightweight tags as well
DESCRIBE=`git tag -l --sort=-v:refname | grep -v nightly | head -n 1`
MAJOR_VERSION=`echo $DESCRIBE | awk '{split($0,a,"."); print a[1]}'`
MINOR_VERSION=`echo $DESCRIBE | awk '{split($0,a,"."); print a[2]}'`
MINOR_VERSION="$((${MINOR_VERSION} + 1))"
TAG="${MAJOR_VERSION}.${MINOR_VERSION}.0-nightly.$(date +'%Y%m%d')"
git tag -a $TAG -m "$TAG: nightly build"
git push origin $TAG
- name: 'Clean up nightly releases'
uses: dev-drprasad/[email protected]
with:
keep_latest: 1
delete_tags: true
delete_tag_pattern: nightly
delete_prerelease_only: true
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
9 changes: 9 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-nightly.[0-9]+'

permissions:
contents: write
Expand All @@ -18,6 +19,13 @@ jobs:
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '1.21.0'
- name: Set GORELEASER_PREVIOUS_TAG in actual release
if: ${{ !contains(github.ref, '-nightly') }}
# find previous tag by filtering out nightly tags and choosing the
# second to last tag (last one is the current release)
run: |
prev_tag=$(git tag | grep -v "nightly" | sort -r --version-sort | head -n 2 | tail -n 1)
echo "GORELEASER_PREVIOUS_TAG=$prev_tag" >> $GITHUB_ENV
# Ensure generation tools run
- name: build
run: |
Expand All @@ -30,3 +38,4 @@ jobs:
args: release --clean --timeout 30m
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
10 changes: 5 additions & 5 deletions pkg/cmd/create/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import (

var (
// Flags
recreateCluster bool
buildName string
kubeVersion string
extraPortsMapping string
kindConfigPath string
recreateCluster bool
buildName string
kubeVersion string
extraPortsMapping string
kindConfigPath string
// TODO: Remove extraPackagesDirs after 0.6.0 release
extraPackagesDirs []string
extraPackages []string
Expand Down

0 comments on commit e454aed

Please sign in to comment.