Skip to content

Publish Docker image #9

Publish Docker image

Publish Docker image #9

Workflow file for this run

name: Publish Docker image
on:
release:
types: [published]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
module: ["", "api", "metrics", "api,metrics"]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Tag default image
if: ${{ matrix.module == "api,metrics" }}

Check failure on line 27 in .github/workflows/push_docker.yml

View workflow run for this annotation

GitHub Actions / Publish Docker image

Invalid workflow file

The workflow is not valid. .github/workflows/push_docker.yml (Line: 27, Col: 19): Unexpected symbol: '"api'. Located at position 18 within expression: matrix.module == "api,metrics" .github/workflows/push_docker.yml (Line: 30, Col: 19): Unexpected symbol: '"api"'. Located at position 18 within expression: matrix.module == "api"
run: echo "IMAGE_TAG_SUFFIX=" >> "$GITHUB_OUTPUT"
- name: Tag api image
if: ${{ matrix.module == "api" }}
run: echo "IMAGE_TAG_SUFFIX=-api" >> "$GITHUB_OUTPUT"
- name: Tag metrics image
if: ${{ matrix.module == "metrics" }}
run: echo "IMAGE_TAG_SUFFIX=-metrics" >> "$GITHUB_OUTPUT"
- name: Tag light image
if: ${{ matrix.module == "" }}
run: echo "IMAGE_TAG_SUFFIX=light" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.multistage
push: true
build-args: |
TAGS=${{ matrix.module }}
tags: ${{ secrets.DOCKER_USERNAME }}/stone-proxy:latest${{ env.IMAGE_TAG_SUFFIX }}, ${{ secrets.DOCKER_USERNAME }}/stone-proxy:${{ env.RELEASE_VERSION }}${{ env.IMAGE_TAG_SUFFIX }},