Fix local docker tag to match the one produced by CI (#11) #17
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 | |
on: | |
push: | |
tags: | |
- 'v*' | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Run tests | |
run: npm run ci:test | |
- name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
name=ghcr.io/cartesi/rollups-explorer-api | |
name=docker.io/cartesi/rollups-explorer-api,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=ref,event=branch | |
type=ref,event=pr | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: depot/setup-action@v1 | |
- name: Build and push docker image | |
id: docker_build | |
uses: depot/bake-action@v1 | |
with: | |
files: | | |
./docker-bake.hcl | |
${{ steps.docker_meta.outputs.bake-file }} | |
./docker-bake.platforms.hcl | |
push: true | |
project: ${{ vars.DEPOT_PROJECT }} |