Skip to content

Set latest tag only for released release #37

Set latest tag only for released release

Set latest tag only for released release #37

Workflow file for this run

name: Publish Docker image
on:
release:
types: [published]
pull_request:
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: 1.20.7
id: go
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build and run chain simulator to fetch configs
run: |
cd cmd/chainsimulator
go build
./chainsimulator --fetch-configs-and-close
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for released releases
if: ${{ github.event.release.prerelease == false }}
id: meta_released
uses: docker/metadata-action@v5
with:
images: multiversx/chainsimulator
tags: |
type=ref,event=release
type=raw,value=latest
labels: type=ref,event=release
- name: Extract metadata (tags, labels) for prereleased releases
if: ${{ github.event.release.prerelease == true }}
id: meta_prereleased
uses: docker/metadata-action@v5
with:
images: multiversx/chainsimulator
tags: type=ref,event=release
labels: type=ref,event=release
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'release' && github.event.action == 'published' }}
tags: ${{ github.event.release.prerelease == false ? steps.meta_released.outputs.tags : steps.meta_prereleased.outputs.tags }}

Check failure on line 78 in .github/workflows/deploy-docker.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/deploy-docker.yml

Invalid workflow file

You have an error in your yaml syntax on line 78
labels: ${{ github.event.release.prerelease == false ? steps.meta_released.outputs.labels : steps.meta_prereleased.outputs.labels }}