Skip to content

Merge remote-tracking branch 'upstream/v2' into v2 #30

Merge remote-tracking branch 'upstream/v2' into v2

Merge remote-tracking branch 'upstream/v2' into v2 #30

name: Build Windows and Linux Toolchain Image
on:
push:
branches: [v2]
# Publish semver tags as releases.
tags: ['v*.*.*']
pull_request:
branches: [v2]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}-win-linux
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Extract Rack image version
run: |
echo "RACK_DOCKER_IMAGE_VERSION=$(/bin/egrep -i '^DOCKER_IMAGE_VERSION.*:=' Makefile | tr -cd '[:digit:]')" >> $GITHUB_ENV
- name: Extract Rack SDK version
run: |
echo "RACK_SDK_VERSION=$(/bin/egrep -i '^RACK_SDK_VERSION.*:=' Makefile | cut -d ' ' -f 3)" >> $GITHUB_ENV
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ env.RACK_DOCKER_IMAGE_VERSION }}
type=raw,value=rack-sdk-${{ env.RACK_SDK_VERSION }}
type=sha
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max