Skip to content

change config

change config #90

Workflow file for this run

name: Deploy docker image and update production
on:
push:
branches:
- "main"
env:
REGISTRY: ghcr.io
DOCKER_STACKE_NAME: stack-mixdrinks
DEPLOY_USER: deploy
HOST: 167.235.52.168
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get repository name in lowercase
id: repo_name
run: echo "REPO_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REPO_NAME }}:latest
${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ github.sha }}
build-args: |
GIT_COMMIT_SHA=${{ github.sha }}
deploy:
runs-on: ubuntu-latest
needs:
- build-and-push-image
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create env file
run: |
echo "GIT_COMMIT_HASH=${{ github.sha }}" >> ./envfile
- name: Docker Stack Deploy
uses: cssnr/stack-deploy-action@v1
with:
name: ${{ env.DOCKER_STACKE_NAME }}
file: docker-stack.yaml
host: ${{ env.HOST }}
user: ${{ env.DEPLOY_USER }}
ssh_key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
env_file: ./envfile