fix ci #243
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
# Runs when `release-*` branch is created or push changes into `release-*` branch. | |
name: Docker Build Production Release | |
on: | |
create: | |
push: | |
branches: | |
- release-** | |
paths-ignore: | |
- '**/README.md' | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: Branch to build docker image (optional). Helpful to build docker image for release branches that don't have image | |
required: false | |
type: string | |
jobs: | |
clean-up-actions: | |
runs-on: ubuntu-latest | |
# Skip non-release branches | |
if: startsWith(github.ref_name, 'release-') | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
setup-matrix: | |
runs-on: ubuntu-latest | |
needs: clean-up-actions | |
outputs: | |
matrix: ${{ steps.docker-setup-matrix.outputs.matrix }} | |
version: ${{ steps.docker-setup-matrix.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Setup Matrix | |
id: docker-setup-matrix | |
run: python .github/scripts/docker_setup_matrix.py ${{ github.event.inputs.branch || github.ref }} | |
build-image: | |
name: "Build docker image ${{ matrix.network }}" | |
runs-on: [self-hosted, linux] | |
needs: setup-matrix | |
strategy: | |
matrix: ${{fromJson(needs.setup-matrix.outputs.matrix)}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch || github.ref }} | |
submodules: recursive | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ghcr.io/acalanetwork/${{ matrix.network }}-node | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=raw,value=${{ needs.setup-matrix.outputs.version || github.ref_name }} | |
type=ref,event=pr | |
type=sha | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
BUILD_ARGS=build-${{ matrix.network }}-release | |
GIT_COMMIT=${{ env.GITHUB_SHA }} | |
PROFILE=production | |
file: scripts/Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
trigger: | |
needs: build-image | |
if: ${{ startsWith(github.ref_name, 'release-') }} | |
uses: ./.github/workflows/extrinsic-ordering-check-on-release.yml | |
secrets: inherit | |
with: | |
chain: ${{ matrix.network }} |