build #244
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
################################################################################## | |
# References: | |
# Built-in arguments: | |
# - https://docs.github.com/en/actions/learn-github-actions/contexts | |
# Built-in environment variables: | |
# - https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/variables#default-environment-variables | |
# | |
# Develop this workflow locally with the following command: | |
# ~$ gh extension install nektos/gh-act | |
# ~$ gh act --env-file .env -s GITHUB_TOKEN=$GITHUB_TOKEN -s PULUMI_ACCESS_TOKEN=$PULUMI_ACCESS_TOKEN | |
name: Build Konductor Devcontainer | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "Makefile" | |
- ".devcontainer/**" | |
- ".pulumi/**" | |
- ".talos/**" | |
- ".kube/**" | |
- "docs/**" | |
- "**.md" | |
pull_request: | |
paths-ignore: | |
- "Makefile" | |
- ".devcontainer/**" | |
- ".pulumi/**" | |
- ".talos/**" | |
- ".kube/**" | |
- "docs/**" | |
- "**.md" | |
branches: | |
- main | |
schedule: | |
- cron: "0 2 * * *" # Daily at 2am UTC | |
jobs: | |
build-konductor: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
actions: write | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v4 | |
id: git-checkout | |
with: | |
ref: "main" | |
submodules: "shallow" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
id: qemu | |
- name: Install Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
id: docker-buildx | |
- name: repository_owner to lower case | |
uses: Entepotenz/change-string-case-action-min-dependencies@v1 | |
id: string-owner-to-lower | |
with: | |
string: ${{ github.repository_owner }} | |
- name: Transform repository name to lower case | |
uses: Entepotenz/change-string-case-action-min-dependencies@v1 | |
id: string-repository-to-lower | |
with: | |
string: ${{ github.repository }} | |
- name: Github Container Registry Login | |
id: docker-login | |
if: ${{ github.event_name == 'push' }} && ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
echo ${{ secrets.GHA_GITHUB_TOKEN }} | docker login ghcr.io -u usrbinkat --password-stdin | |
# - name: Build Konductor Container Image | |
# uses: docker/build-push-action@v5 | |
# id: docker-build-cache | |
# if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main') | |
# with: | |
# push: false | |
# cache-from: | | |
# type=registry,ref=ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:build-cache | |
# type=registry,ref=ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:latest | |
# cache-to: type=inline,mode=max | |
# context: .github/devcontainer/docker | |
# file: .github/devcontainer/docker/Dockerfile | |
# platforms: linux/amd64,linux/arm64 | |
# tags: "ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:latest,ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:${{ github.sha }}" | |
- name: Publish Konductor Container Image | |
uses: docker/build-push-action@v5 | |
id: docker-build-push | |
#if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
with: | |
push: true | |
context: .github/docker | |
file: .github/docker/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
tags: "ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:latest,ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:${{ github.sha }}" | |
#cache-from: | | |
# type=registry,ref=ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:build-cache | |
# type=registry,ref=ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:latest | |
#cache-to: type=registry,ref=ghcr.io/${{ steps.string-repository-to-lower.outputs.lowercase }}:build-cache,mode=max | |
- name: Cleanup | |
id: make-clean-all | |
if: always() | |
run: make clean-all | |
env: | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |