Skip to content

refactor: moved test workflow to separate job in original file #5

refactor: moved test workflow to separate job in original file

refactor: moved test workflow to separate job in original file #5

Workflow file for this run

name: Docker Build & Release
on:
push:
branches:
- main
- develop
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
test-build-release:
name: Build & Release (Test)
runs-on: ubuntu-latest
steps:
- 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_PASSWORD }}
- name: Build & Push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
push: true
tags: |
4lch4/shion-api:${{ github.sha }}
4lch4/shion-api:latest
4lch4/shion-api:test
deploy:
name: Deploy Production Image
runs-on: ubuntu-latest
needs: test-build-release
if: startsWith(github.ref, 'refs/tags/')
steps:
- 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_PASSWORD }}
- name: Extract Tag Name
id: extract_tag
run: echo "DOCKER_IMAGE_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Build & Push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: |
4lch4/shion-api:${{ env.DOCKER_IMAGE_NAME }}
4lch4/shion-api:${{ github.sha }}
4lch4/shion-api:latest