Docker build CI triggered from @sduchesneau of #61
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: Docker build CI | |
run-name: Docker build CI triggered from @${{ github.actor }} of ${{ github.head_ref }} | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
tags: | |
- '*' | |
branches: | |
- release/* | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
docker: | |
name: Docker build | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Delete files | |
shell: bash | |
run: | | |
df -h | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /opt/hostedtoolcache/CodeQL | |
df -h | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate docker tags/labels from github build context | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# We tag latest only release of the form <variant>-v<major>.<minor>.<patch>-fh2.1 so "rc/beta" version are not flagged as latest | |
# - 2 docker tags: `{geth|bsc|...}-latest` and `{git-tag}` | |
tags: | | |
type=ref,event=tag,priority=1000,prefix=nitro- | |
type=ref,enable=true,priority=600,prefix=nitro-,suffix=,event=branch | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |