Nightly Images Build #311
Workflow file for this run
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: Nightly Images Build | |
on: | |
schedule: | |
# doing builds Tue-Sat, so we have changes from Fri | |
# available already on Sat | |
- cron: '0 0 * * 2-6' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
nightly-release: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- | |
name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to GitHub Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Set Nightly Version | |
run: | | |
commit=$(git rev-parse --short HEAD) | |
ts=$(date +%s) | |
version="v999.0.0-$ts.$commit.nightly" | |
echo "VERSION=$version" >> $GITHUB_ENV | |
echo "### $version :rocket:" >> $GITHUB_STEP_SUMMARY | |
- | |
name: Build | |
env: | |
GOOS: linux | |
run: | | |
export GOARCH=amd64 | |
go build -gcflags='all=-N -l' -o bin/fleetcontroller-linux-amd64 ./cmd/fleetcontroller | |
go build -gcflags='all=-N -l' -o bin/fleet-linux-amd64 ./cmd/fleetcli | |
go build -gcflags='all=-N -l' -o bin/fleetagent-linux-amd64 ./cmd/fleetagent | |
export GOARCH=arm64 | |
go build -gcflags='all=-N -l' -o bin/fleetcontroller-linux-arm64 ./cmd/fleetcontroller | |
go build -gcflags='all=-N -l' -o bin/fleet-linux-arm64 ./cmd/fleetcli | |
go build -gcflags='all=-N -l' -o bin/fleetagent-linux-arm64 ./cmd/fleetagent | |
- | |
id: meta-fleet | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/rancher/fleet | |
tags: ${{ env.VERSION }} | |
- | |
name: Build and push controller | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: package/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
build-args: | | |
BUILD_ENV=buildx | |
tags: ${{ steps.meta-fleet.outputs.tags }} | |
labels: ${{ steps.meta-fleet.outputs.labels }} | |
- | |
id: meta-fleet-agent | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/rancher/fleet-agent | |
tags: ${{ env.VERSION }} | |
- | |
name: Build and push agent | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: package/Dockerfile.agent | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
build-args: | | |
BUILD_ENV=buildx | |
tags: ${{ steps.meta-fleet-agent.outputs.tags }} | |
labels: ${{ steps.meta-fleet-agent.outputs.labels }} | |
- | |
name: Build Helm Chart | |
run: | | |
repo="ghcr.io/rancher/fleet" | |
sed -i \ | |
-e "s@repository:.*@repository: $repo@" \ | |
-e "s/tag:.*/tag: ${VERSION}/" \ | |
charts/fleet/values.yaml | |
sed -i \ | |
-e "s@repository:.*@repository: $repo@" \ | |
-e "s/tag: dev/tag: ${VERSION}/" \ | |
charts/fleet-agent/values.yaml | |
helm package --version="$VERSION" --app-version="$VERSION" -d ./dist ./charts/fleet | |
helm package --version="$VERSION" --app-version="$VERSION" -d ./dist ./charts/fleet-crd | |
helm package --version="$VERSION" --app-version="$VERSION" -d ./dist ./charts/fleet-agent | |
- | |
name: Upload Controller Chart | |
uses: actions/upload-artifact@v4 | |
with: | |
name: fleet-${{ env.VERSION }}.tgz | |
path: ./dist/fleet-${{ env.VERSION }}.tgz | |
retention-days: 3 | |
- | |
name: Upload CRD Chart | |
uses: actions/upload-artifact@v4 | |
with: | |
name: fleet-crd-${{ env.VERSION }}.tgz | |
path: ./dist/fleet-crd-${{ env.VERSION }}.tgz | |
retention-days: 3 | |
- | |
name: Upload Agent Chart | |
uses: actions/upload-artifact@v4 | |
with: | |
name: fleet-agent-${{ env.VERSION }}.tgz | |
path: ./dist/fleet-agent-${{ env.VERSION }}.tgz | |
retention-days: 3 |