Start rebuilding the GH actions for speed #1
Workflow file for this run
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 | |
on: | |
push: | |
branches: [main, 'release-v**'] | |
pull_request: | |
paths: | |
- ".github/workflows/build-docker.yml" | |
- "Dockerfile" | |
workflow_dispatch: | |
env: | |
RUST_TOOLCHAIN: "1.66" | |
jobs: | |
docker: | |
strategy: | |
matrix: | |
os: [ ubuntu-latest-4-cores ] | |
target: [ release, test ] | |
runs-on: ${{ matrix.os }} | |
env: | |
WORKFLOW_TAG: ${{ github.event.inputs.docker_tag }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Free space | |
# https://github.com/actions/runner-images/issues/2840#issuecomment-1284059930 | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- name: check available docker space | |
run: | | |
docker volume ls | |
df -h | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: DockerHub Login | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- run: echo "NOW=$(date -u +%Y%m%d)" >> $GITHUB_ENV | |
- name: Setup docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: centrifugeio/centrifuge-chain | |
flavor: | | |
prefix=${{ matrix.target == 'test' && 'test-' || '' }} | |
suffix=${{ env.NOW }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=tag | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}} | |
type=sha,format=short,prefix='git-' | |
- name: Build and push centrifugeio/centrifuge-chain | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ github.ref == '/refs/heads/main' && true || false }} | |
tags: ${{ steps.meta.outputs.tags }} | |
# Cache options: | |
# https://docs.docker.com/build/ci/github-actions/cache/ | |
cache-from: type=registry,ref=centrifugeio/centrifuge-chain | |
# https://docs.docker.com/build/cache/backends/inline/ | |
cache-to: inline | |
- name: Update DockerHub descriptions | |
if: contains(github.ref, 'refs/tags/release-v') | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
repository: centrifuge/centrifuge-chain | |
short-description: ${{ github.event.repository.description }} | |
enable-url-completion: true | |
- if: failure() | |
name: Check available space after build failed | |
run: | | |
docker volume ls | |
df -h |