Skip to content

ci: adding release to pr build for testing #13

ci: adding release to pr build for testing

ci: adding release to pr build for testing #13

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.
name: Test Blog Docker image
on:
pull_request:
paths:
- "/blog"
- ".github/workflows/build-blog.yaml"
env:
GITHUB_ORG: hyperfluid-solutions
GITHUB_REPO: baseimages
IMAGE_LICENSES: MIT
IMAGE_VENDOR: Hyperfluid Solutions Corp.
jobs:
build_image:
name: Build Docker image
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
id: push
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85
with:
context: ./blog
file: ./blog/Dockerfile
push: false
test_deploy:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
path: [blog]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Loading buildconfig.json into env.BUILDCONFIG
run: echo "BUILDCONFIG=$(jq -c . < ${{ matrix.path }}/buildconfig.json)" >> $GITHUB_ENV
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ fromJson(env.BUILDCONFIG).platforms }}
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Parse Semver
id: semver
uses: booxmedialtd/[email protected]
with:
input_string: ${{ fromJson(env.BUILDCONFIG).version }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ env.GITHUB_ORG }}/${{ matrix.path }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}},value=${{ fromJson(env.BUILDCONFIG).version }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}
type=semver,pattern={{major}},value=${{ steps.semver.outputs.major }}
type=sha
# Predefined Annotation Keys:
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
labels: |
org.opencontainers.image.name=${{ matrix.path }}
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSES }}
org.opencontainers.image.vendor=${{ env.IMAGE_VENDOR }}
org.opencontainers.image.version=${{ fromJson(env.BUILDCONFIG).version }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.url=https://github.com/${{ env.GITHUB_ORG }}/baseimages/releases/tag/${{ matrix.path }}-v${{ fromJson(env.BUILDCONFIG).version }}
org.opencontainers.image.source=https://github.com/${{ env.GITHUB_ORG }}/baseimages
org.opencontainers.image.title=${{ matrix.path }}
org.opencontainers.image.documentation=https://github.com/${{ env.GITHUB_ORG }}/${{ env.GITHUB_REPO }}/blob/main/${{ fromJson(env.BUILDCONFIG).documentation }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./${{ matrix.path }}
file: ./${{ matrix.path }}/Dockerfile
# platforms: ${{ fromJson(env.BUILDCONFIG).platforms }}
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
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