Skip to content

Release

Release #67

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
env:
REGISTRY: ghcr.io
IMAGE_NAME: nrel/api-umbrella
DOCKER_BUILDKIT: 1
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Check version matches tag
run: |
tag_version="$GITHUB_REF_NAME"
file_version="v$(cat src/api-umbrella/version.txt)"
if [ "$tag_version" != "$file_version" ]; then
echo "Tag version ($tag_version) does not match file version ($file_version)" 1>&2
exit 1
fi
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Runtime container metadata
id: runtime_meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
- name: Runtime egress container metadata
id: runtime_egress_meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,prefix=egress-,pattern={{version}}
- name: Build and push runtime
uses: docker/build-push-action@v5
with:
target: runtime
pull: true
push: true
tags: ${{ steps.runtime_meta.outputs.tags }}
labels: ${{ steps.runtime_meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache-runtime-recent,mode=max
provenance: false
- name: Build and push runtime-egress
uses: docker/build-push-action@v5
with:
target: runtime-egress
pull: true
push: true
tags: ${{ steps.runtime_egress_meta.outputs.tags }}
labels: ${{ steps.runtime_egress_meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache-runtime-recent,mode=max
provenance: false