Skip to content

chore: correct order numbers of Table of Contents in readme file #104

chore: correct order numbers of Table of Contents in readme file

chore: correct order numbers of Table of Contents in readme file #104

Workflow file for this run

---
name: Clean Architecture the template CI/CD
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
DOTNET_INSTALL_DIR: "./.dotnet"
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
DOCKER_BUILDKIT: "1"
jobs:
build:
name: πŸ› οΈ Restore β€’ Build β€’ Test β€’ Publish
runs-on: self-hosted
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.101"
cache: true
cache-dependency-path: |
src/*/packages.lock.json
tests/*/packages.lock.json
- name: Clean the solution
run: dotnet clean
# my vm server got a problem with ipv6
#I use "export DOTNET_SYSTEM_NET_DISABLEIPV6=1" command to disable it if you don't remove this
- name: Install dependencies
run: |
export DOTNET_SYSTEM_NET_DISABLEIPV6=1
dotnet restore --locked-mode
- name: Build
run: dotnet build --configuration Release --no-restore
- name: App Settings Variable Substitution
uses: iamazeem/substitute-action@v1
env:
DB_CONNECTION: ${{ secrets.DB_CONNECTION_STRING }}
S3_KEY: ${{ secrets.S3_KEY }}
S3_SECRET: ${{ secrets.S3_SECRET }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
S3_BUCKET: ${{ secrets.S3_BUCKET }}
URLS: ${{ secrets.URLS }}
with:
input-files: ${{ github.workspace }}/${{vars.SUBSTITUTE_FILE_PATH}}
- name: Test
run: dotnet test --no-restore --verbosity normal -e ASPNETCORE_ENVIRONMENT=Deployment
- name: Publish Application
run: dotnet publish -c Release --property:PublishDir=${{ github.workspace }}/app/publish
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: app-build
path: |
${{ github.workspace }}/app/publish
retention-days: 3
docker:
name: 🐳 Build & Push Docker Image
needs: build
runs-on: self-hosted
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
# Download the artifact from the build job
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: app-build
path: |
${{ github.workspace }}/app/publish
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
# Login to GitHub Container Registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.PWD_TOKEN }}
# add tag for docker sha and latest
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.REGISTRY }}/${{ github.actor }}/${{ vars.IMAGE_NAME }}
tags: |
type=raw,value=${{ github.ref_name }}-${{ github.sha }}
type=raw,value=${{ github.ref_name }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
name: πŸš€ Deploy to Production Server
needs: docker
runs-on: self-hosted
permissions:
contents: read
environment: production
steps:
- name: Deploy to Server
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ vars.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: 22
script: |
echo "${{ secrets.PWD_TOKEN }}" | docker login ${{ vars.REGISTRY }} -u ${{ github.actor }} --password-stdin
docker pull ${{ vars.REGISTRY }}/${{ github.actor }}/${{ vars.IMAGE_NAME }}:${{ github.ref_name }}
cd ${{ secrets.APP_PATH }}
docker compose up -d
docker image prune -f
docker logout ${{ vars.REGISTRY }}