Skip to content

Pulumi Devcontainer Build #107

Pulumi Devcontainer Build

Pulumi Devcontainer Build #107

Workflow file for this run

##################################################################################
# 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: Pulumi Devcontainer Build
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- 'devcontainer**'
- 'devcontainer/**'
- '.devcontainer/**'
- '.pulumi/**'
- '.kube/**'
- 'docs/**'
- '**.md'
pull_request:
paths-ignore:
- 'devcontainer**'
- 'devcontainer/**'
- '.devcontainer/**'
- '.pulumi/**'
- '.kube/**'
- 'docs/**'
- '**.md'
branches:
- main
schedule:
- cron: '0 0 * * 0'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
actions: write
steps:
-
name: Git Checkout
uses: actions/checkout@v4
id: git
with:
ref: 'main'
submodules: 'recursive'
clean: ''
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
id: qemu
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
id: buildx
-
name: Login to GitHub Container Registry
id: login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: repository_owner to lower case
id: repository_owner
uses: Entepotenz/change-string-case-action-min-dependencies@v1
with:
string: ${{ github.repository_owner }}
-
name: repository to lower case
id: repository
uses: Entepotenz/change-string-case-action-min-dependencies@v1
with:
string: ${{ github.repository }}
-
name: Build Container Image
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
uses: docker/build-push-action@v5
with:
push: false
cache-from: |
type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:build-cache
type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:latest
cache-to: type=inline,mode=max
context: ./docker
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}"
-
name: Push Container Image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
push: true
cache-from: |
type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:build-cache
type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:latest
cache-to: type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:build-cache,mode=max
context: ./docker
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}"
# -
# name: Build Container Image
# if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
# uses: docker/build-push-action@v5
# with:
# push: false
# cache-from: type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:latest
# cache-to: type=inline
# context: ./docker
# file: ./docker/Dockerfile
# platforms: linux/amd64,linux/arm64
# tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}"
#
# -
# name: Push Container Image
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# uses: docker/build-push-action@v5
# with:
# push: true
# cache-from: type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:latest
# cache-to: type=inline
# context: ./docker
# file: ./docker/Dockerfile
# platforms: linux/amd64,linux/arm64
# tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}"