Configure Renovate #18
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: Build BYOH | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*.*.*" | |
jobs: | |
artifacts: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build | |
env: | |
FORCE_COLOR: 3 | |
run: | | |
npx zx <<'EOF' | |
const script = require('./.github/workflows/build-byoh.js').buildArtifacts | |
script().then(result => { | |
console.log(result) | |
}).catch(err => { | |
throw err | |
}) | |
EOF | |
- name: Publish Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: true | |
generate_release_notes: true | |
files: | | |
byoh/_dist/byoh-hostagent-linux-amd64 | |
byoh/_dist/byoh-hostagent-linux-arm64 | |
byoh/_dist/cluster-template.yaml | |
byoh/_dist/cluster-template-topology.yaml | |
byoh/_dist/clusterclass-quickstart.yaml | |
byoh/_dist/cluster-template-docker.yaml | |
byoh/_dist/cluster-template-topology-docker.yaml | |
byoh/_dist/clusterclass-quickstart-docker.yaml | |
byoh/_dist/infrastructure-components.yaml | |
byoh/_dist/metadata.yaml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
image: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build | |
env: | |
FORCE_COLOR: 3 | |
run: | | |
npx zx <<'EOF' | |
const { cloneBYOH, getVersion } = require('./.github/workflows/build-byoh.js'); | |
(async () => { | |
await cloneBYOH("./byoh", getVersion()) | |
})().then(result => { | |
console.log(result) | |
}).catch(err => { | |
throw err | |
}) | |
EOF | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- | |
name: Login to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository_owner }}/cluster-api-byoh-controller | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
type=sha | |
- | |
name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.arch }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx}-${{ matrix.arch }}- | |
- | |
name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./byoh | |
file: ./byoh/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
- | |
# Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |