v0.8.0 #101
Workflow file for this run
This file contains hidden or 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: Publish Docker Images | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag to publish (e.g., v0.2.3)' | |
| required: true | |
| type: string | |
| env: | |
| NODE_VERSION: '20' | |
| PNPM_VERSION: '10' | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| # Extract version info first | |
| prepare: | |
| name: Prepare Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| is_stable: ${{ steps.version.outputs.is_stable }} | |
| steps: | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| VERSION="${{ github.event.inputs.tag }}" | |
| elif [ "${{ github.event_name }}" = "release" ]; then | |
| VERSION="${{ github.event.release.tag_name }}" | |
| else | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| fi | |
| VERSION=${VERSION#v} | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "Version: ${VERSION}" | |
| if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "is_stable=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "is_stable=false" >> $GITHUB_OUTPUT | |
| fi | |
| # Build images on native runners for each architecture | |
| build: | |
| name: Build (${{ matrix.platform }}) | |
| needs: prepare | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-latest | |
| suffix: amd64 | |
| - platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| suffix: arm64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push backend image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: packages/backend/Dockerfile | |
| push: true | |
| tags: | | |
| logtide/backend:${{ needs.prepare.outputs.version }}-${{ matrix.suffix }} | |
| ghcr.io/${{ github.repository_owner }}/logtide-backend:${{ needs.prepare.outputs.version }}-${{ matrix.suffix }} | |
| cache-from: type=gha,scope=backend-${{ matrix.suffix }} | |
| cache-to: type=gha,mode=max,scope=backend-${{ matrix.suffix }} | |
| platforms: ${{ matrix.platform }} | |
| - name: Build and push frontend image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: packages/frontend/Dockerfile | |
| push: true | |
| tags: | | |
| logtide/frontend:${{ needs.prepare.outputs.version }}-${{ matrix.suffix }} | |
| ghcr.io/${{ github.repository_owner }}/logtide-frontend:${{ needs.prepare.outputs.version }}-${{ matrix.suffix }} | |
| cache-from: type=gha,scope=frontend-${{ matrix.suffix }} | |
| cache-to: type=gha,mode=max,scope=frontend-${{ matrix.suffix }} | |
| platforms: ${{ matrix.platform }} | |
| build-args: | | |
| PUBLIC_API_URL=http://localhost:8080 | |
| # Merge architecture-specific images into multi-arch manifests | |
| merge: | |
| name: Create Multi-Arch Manifests | |
| needs: [prepare, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Create and push backend manifests | |
| run: | | |
| VERSION="${{ needs.prepare.outputs.version }}" | |
| IS_STABLE="${{ needs.prepare.outputs.is_stable }}" | |
| # Docker Hub | |
| docker buildx imagetools create -t logtide/backend:${VERSION} \ | |
| logtide/backend:${VERSION}-amd64 \ | |
| logtide/backend:${VERSION}-arm64 | |
| # GHCR | |
| docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/logtide-backend:${VERSION} \ | |
| ghcr.io/${{ github.repository_owner }}/logtide-backend:${VERSION}-amd64 \ | |
| ghcr.io/${{ github.repository_owner }}/logtide-backend:${VERSION}-arm64 | |
| # Latest tag for stable releases | |
| if [ "$IS_STABLE" = "true" ]; then | |
| docker buildx imagetools create -t logtide/backend:latest \ | |
| logtide/backend:${VERSION}-amd64 \ | |
| logtide/backend:${VERSION}-arm64 | |
| docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/logtide-backend:latest \ | |
| ghcr.io/${{ github.repository_owner }}/logtide-backend:${VERSION}-amd64 \ | |
| ghcr.io/${{ github.repository_owner }}/logtide-backend:${VERSION}-arm64 | |
| fi | |
| - name: Create and push frontend manifests | |
| run: | | |
| VERSION="${{ needs.prepare.outputs.version }}" | |
| IS_STABLE="${{ needs.prepare.outputs.is_stable }}" | |
| # Docker Hub | |
| docker buildx imagetools create -t logtide/frontend:${VERSION} \ | |
| logtide/frontend:${VERSION}-amd64 \ | |
| logtide/frontend:${VERSION}-arm64 | |
| # GHCR | |
| docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/logtide-frontend:${VERSION} \ | |
| ghcr.io/${{ github.repository_owner }}/logtide-frontend:${VERSION}-amd64 \ | |
| ghcr.io/${{ github.repository_owner }}/logtide-frontend:${VERSION}-arm64 | |
| # Latest tag for stable releases | |
| if [ "$IS_STABLE" = "true" ]; then | |
| docker buildx imagetools create -t logtide/frontend:latest \ | |
| logtide/frontend:${VERSION}-amd64 \ | |
| logtide/frontend:${VERSION}-arm64 | |
| docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/logtide-frontend:latest \ | |
| ghcr.io/${{ github.repository_owner }}/logtide-frontend:${VERSION}-amd64 \ | |
| ghcr.io/${{ github.repository_owner }}/logtide-frontend:${VERSION}-arm64 | |
| fi | |
| - name: Create release summary | |
| run: | | |
| echo "## Docker Images Published" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Backend" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "docker pull logtide/backend:${{ needs.prepare.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "docker pull ghcr.io/${{ github.repository_owner }}/logtide-backend:${{ needs.prepare.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Frontend" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "docker pull logtide/frontend:${{ needs.prepare.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "docker pull ghcr.io/${{ github.repository_owner }}/logtide-frontend:${{ needs.prepare.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY |