CI was fixed (#2) #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and push Docker image | |
on: | |
push: | |
branches: | |
pull_request: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
docker-images: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
debian-versions: [buster, bullseye, bookworm] | |
rust-versions: [1.72.0] | |
clang-versions: [15, 16] | |
steps: | |
- name: Set environmental variables | |
run: | | |
echo "FULL_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:debian-${{ matrix.debian-versions }}-rust-${{ matrix.rust-versions }}-clang-${{ matrix.clang-versions }}" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: dockerfiles | |
file: dockerfiles/Dockerfile.amd64 | |
push: false | |
load: true | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
DEBIAN_VERSION=${{ matrix.debian-versions }} | |
RUST_STABLE_VERSION=${{ matrix.rust-versions }} | |
CLANG_VERSION=${{ matrix.clang-versions }} | |
tags: ${{ env.FULL_IMAGE_NAME }},image-to-test:latest | |
- name: Switch to default Docker builder | |
run: docker buildx use default | |
- name: Build node to test Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: dockerfiles | |
file: dockerfiles/Dockerfile.test | |
push: false | |
pull: false | |
build-args: | | |
IMAGE_VERSION=image-to-test:latest | |
GIT_REF=polkadot-v1.1.0 | |
tags: test-build-image | |
- name: Push Docker image | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: docker push ${{ env.FULL_IMAGE_NAME }} |