Skip to content

chore(deps): bump actions/upload-artifact from 2 to 3 (#1094) #129

chore(deps): bump actions/upload-artifact from 2 to 3 (#1094)

chore(deps): bump actions/upload-artifact from 2 to 3 (#1094) #129

name: Web3 Indexer Docker Build Push
on:
push:
branches: [ 'main', 'dev*', 'v1*', '1.*' ]
# Publish semver tags as releases.
tags: [ 'v*.*.*', '1.*' ]
# This event occurs when a GitHub Actions workflow is manually triggered.
# For more information, see
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
# Note: Write access to the repository is required to perform these steps.
workflow_dispatch:
inputs:
runner_type:
description: 'Choose an appropriate runner'
required: true
default: ubuntu-20.04
type: choice
options:
- ubuntu-20.04
- self-hosted
env:
# Use ghcr.io only
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: godwoken-web3-indexer-prebuilds
jobs:
docker-build-push:
runs-on: ubuntu-latest
defaults:
run:
working-directory: web3
# If you specify the access for any of these scopes, all of those that are not specified are set to none.
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
# GitHub automatically creates a unique GITHUB_TOKEN secret to use in this workflow.
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=ref,event=branch,suffix=-{{date 'YYYYMMDDHHmm'}}
type=ref,event=branch
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: New Commit Build => Build and push commit image to ${{ env.REGISTRY }}
uses: docker/build-push-action@v5
with:
file: web3/docker/indexer/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}