Skip to content

Commit

Permalink
Merge pull request #91 from docksal/feature/gha-updates
Browse files Browse the repository at this point in the history
Github Actions updates
  • Loading branch information
lmakarov authored Feb 16, 2024
2 parents 17cfe46 + 6b6a69c commit 91de49e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/docker-tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ done
# Print with new lines for output in build logs
(IFS=$'\n'; echo "${repoImageTagArr[*]}")
# Using newlines in outputs variables does not seem to work, so we'll use comas
(IFS=$','; echo "::set-output name=tags::${repoImageTagArr[*]}")
(IFS=$','; echo "tags=${repoImageTagArr[*]}" | tee -a ${GITHUB_OUTPUT})
27 changes: 14 additions & 13 deletions .github/workflows/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defaults:
jobs:
build-test-push:
name: Build, Test, Push
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

env:
IMAGE: docksal/ci-agent
Expand All @@ -36,45 +36,46 @@ jobs:
bats -v
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
#-
# name: Set up QEMU
# uses: docker/setup-qemu-action@v1
# uses: docker/setup-qemu-action@v3
# buildx has some glitches with local upstream (FROM) images. Disabled.
#-
# name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
# uses: docker/setup-buildx-action@v3
-
name: Check Docker
run: |
docker version
docker info
-
name: Login to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
-
# Calculates docker image tags for the given build context
# The output is used in build and push step as `tags: ${{ steps.docker_meta.outputs.tags }}`
# See https://github.com/crazy-max/ghaction-docker-meta
name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v5
with:
# List of Docker images to use as base name for tags
images: |
${{ env.IMAGE }}
ghcr.io/${{ env.IMAGE }}
tag-sha: true # add git short SHA as Docker tag
# Add git short SHA as Docker tag
tags: |
type=sha
-
# Build for local use
name: Build image (base)
Expand All @@ -95,7 +96,7 @@ jobs:
# Cache image layers in the registry
-
name: Push image cache (base)
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
env:
IMAGE_CACHE: ghcr.io/${{ env.IMAGE }}:base-build
with:
Expand All @@ -107,7 +108,7 @@ jobs:
cache-to: type=inline # Write the cache metadata into the image configuration
-
name: Push image cache (php)
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
env:
IMAGE_CACHE: ghcr.io/${{ env.IMAGE }}:php-build
with:
Expand Down Expand Up @@ -143,7 +144,7 @@ jobs:
# Don't run if the list of tags is empty
# Note: using tags from docker_tags (custom)
if: ${{ steps.docker_tags_base.outputs.tags != '' }}
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: base
file: base/Dockerfile
Expand All @@ -160,7 +161,7 @@ jobs:
# Don't run if the list of tags is empty
# Note: using tags from docker_tags (custom)
if: ${{ steps.docker_tags_php.outputs.tags != '' }}
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: php
file: php/Dockerfile
Expand Down

0 comments on commit 91de49e

Please sign in to comment.