Skip to content

chore(deps): update rust docker digest to 29fe437 #29

chore(deps): update rust docker digest to 29fe437

chore(deps): update rust docker digest to 29fe437 #29

Workflow file for this run

name: Build & Publish Docker Images
on:
push:
branches: [ 'main' ]
pull_request:
env:
REGISTRY: ghcr.io
NAMESPACED_REGISTRY: ghcr.io/apollographql/ci-utility-docker-images
jobs:
calculate-images-to-build:
name: Calculate Images To Build
runs-on: ubuntu-latest
outputs:
changed_dirs: ${{ steps.filter_config_directories.outputs.changed_dirs }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Calculate changed files directories"
id: calculate_changed_files
uses: tj-actions/changed-files@v44
with:
dir_names: true
dir_names_exclude_current_dir: true
json: true
- name: "Filter out config directories"
id: filter_config_directories
run: |
CHANGED_DIRS=$(echo "${{ steps.calculate_changed_files.outputs.all_changed_files }}" | jq -c '[.[] | select(. | contains(".") | not)'])
echo "changed_dirs=$CHANGED_DIRS" >> "$GITHUB_OUTPUT"
build-and-push-images:
if: ${{ needs.calculate-images-to-build.outputs.changed_dirs != '' && toJson(fromJson(needs.calculate-images-to-build.outputs.changed_dirs)) != '[]' }}
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
attestations: write
id-token: write
needs:
- calculate-images-to-build
strategy:
matrix:
changed_dir: ${{ fromJSON(needs.calculate-images-to-build.outputs.changed_dirs ) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Details From config.yml
id: extract_from_config_yaml
run: |
echo "desired_version=$(cat ${{ github.workspace }}/${{ matrix.changed_dir }}/config.yml | yq '.version')" >> "$GITHUB_OUTPUT"
echo "platforms=$(cat ${{ github.workspace }}/${{ matrix.changed_dir }}/config.yml | yq '.platforms | join(",")')" >> "$GITHUB_OUTPUT"
echo "description=$(cat ${{ github.workspace }}/${{ matrix.changed_dir }}/config.yml | yq '.description')" >> "$GITHUB_OUTPUT"
- name: Check Image to Build Does Not Already Exist
run: |
if docker manifest inspect ${{ env.NAMESPACED_REGISTRY }}/${{ matrix.changed_dir }}:${{ steps.extract_from_config_yaml.outputs.desired_version }} > /dev/null; then
echo "The tag "${{ env.NAMESPACED_REGISTRY }}/${{ matrix.changed_dir }}:${{ steps.extract_from_config_yaml.outputs.desired_version }}" already exists in the repository. Do you need to bump the version in the config.yml?"
exit 1
fi
- name: Calculate Version
id: calculate_version
run: |
VERSION=${{ github.event_name == 'pull_request' && format('{0}-PR{1}.{2}', steps.extract_from_config_yaml.outputs.desired_version, github.event.number, github.event.pull_request.head.sha) || steps.extract_from_config_yaml.outputs.desired_version}}
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get Docker Metadata
id: meta
uses: docker/metadata-action@v5
env:
DOCKER_METADATA_PR_HEAD_SHA: true
with:
images: ${{ env.NAMESPACED_REGISTRY }}/${{ matrix.changed_dir }}
tags: |
type=semver,pattern={{version}},value=v${{ steps.calculate_version.outputs.version }}
type=sha,prefix=
labels: |
org.opencontainers.image.title=${{ matrix.changed_dir }}
org.opencontainers.image.description=${{ steps.extract_from_config_yaml.outputs.description }}
org.opencontainers.image.vendor=Apollo GraphQL
org.opencontainers.image.licenses=MIT
annotations: |
org.opencontainers.image.title=${{ matrix.changed_dir }}
org.opencontainers.image.description=${{ steps.extract_from_config_yaml.outputs.description }}
org.opencontainers.image.vendor=Apollo GraphQL
org.opencontainers.image.licenses=MIT
- name: Build and Push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: ${{ github.workspace }}/${{ matrix.changed_dir }}
file: ${{ github.workspace }}/${{ matrix.changed_dir }}/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ steps.extract_from_config_yaml.outputs.platforms }}
- name: Create Git Tag
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: false
default_prerelease_bump: false
custom_tag: ${{ matrix.changed_dir }}/v${{ steps.calculate_version.outputs.version }}
dry_run: ${{ github.event_name == 'pull_request' }}
tag_prefix: ""
- name: Create GitHub Release
if: ${{ github.event_name != 'pull_request' }}
uses: comnoco/create-release-action@v2.0.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ matrix.changed_dir }}/v${{ steps.calculate_version.outputs.version }}
release_name: ${{ matrix.changed_dir }} - v${{ steps.calculate_version.outputs.version }}
check-builds-all-completes:
name: Docker Images Built & Pushed
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- build-and-push-images
steps:
- run: |
exit ${{ (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) && 1 || 0 }}