Skip to content

Workflow file for this run

name: Build and Publish Docker Image
on:
workflow_dispatch:
release:
types: [released]
jobs:
tests:
uses: ./.github/workflows/test.yml
build-and-publish:
needs: [tests]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install dependencies
run: npm install
- name: Get version from Release workflow
id: get_version
run: |
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0") # Assuming tags follow the release version
echo "Version: $VERSION"
echo "::set-output name=version::$VERSION"
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU for multi-platform support
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/statstream:latest
${{ secrets.DOCKER_USERNAME }}/statstream:${{ github.sha }}
${{ secrets.DOCKER_USERNAME }}/statstream:${{ steps.get_version.outputs.version }}
platforms: linux/amd64,linux/arm64
context: ./packages/app