Skip to content

chore: add Docker Swarm stack configuration and README for deployment… #4

chore: add Docker Swarm stack configuration and README for deployment…

chore: add Docker Swarm stack configuration and README for deployment… #4

Workflow file for this run

name: Release Tag
on:
push:
tags:
- 'v*.*.*'
# Add permissions needed for GHCR
permissions:
contents: read
packages: write
jobs:
validate-tag:
name: Validate Semver Tag
runs-on: ubuntu-latest
outputs:
version: ${{ steps.validate.outputs.version }}
is-valid: ${{ steps.validate.outputs.is-valid }}
tag: ${{ steps.validate.outputs.tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate semver tag
id: validate
uses: ./.github/actions/validate-semver-tag
test:
name: Run Tests
needs: validate-tag
if: ${{ needs.validate-tag.outputs.is-valid == 'true' }}
uses: ./.github/workflows/reusable-test.yml
with:
package-filter: "@cbnsndwch/react-router-nest-server"
test-command: "test:cov"
build-command: "build:app"
build-and-push:
name: Build & Push Docker Image
needs: [validate-tag, test]
if: ${{ needs.validate-tag.outputs.is-valid == 'true' && needs.test.outputs.tests_passed == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/cbnsndwch/react-router-nest-server
tags: |
type=semver,pattern={{version}},value=v${{ needs.validate-tag.outputs.version }}
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: apps/server/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max