Skip to content

Commit

Permalink
- changes in deployment paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Blusia committed Aug 20, 2024
1 parent 44c446f commit b410168
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/deploy-to-beta-by-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ concurrency:
cancel-in-progress: true

on:
workflow_dispatch:
push:
branches:
- main
Expand All @@ -16,11 +17,13 @@ jobs:
name: Deploy to beta
runs-on: ubuntu-22.04
env:
REPO_NAME: keating
TARGET_DIR_ON_SERVER: /blumilk/beta/projects
DOCKER_REGISTRY_REPO_NAME: keating
steps:
- name: set branch name
run: echo "BRANCH_NAME=$GITHUB_REF_NAME" >> $GITHUB_ENV

- name: checkout
- name: checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
Expand Down Expand Up @@ -50,7 +53,7 @@ jobs:
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}
images: ghcr.io/${{ github.repository_owner }}/${{ env.DOCKER_REGISTRY_REPO_NAME }}
tags: type=raw,value=beta
context: git

Expand All @@ -62,9 +65,9 @@ jobs:
build-args: DEPLOYMENT_PROJECT_VERSION_ARG=${{ env.DEPLOYMENT_PROJECT_VERSION }}
labels: ${{ steps.meta.outputs.labels }}
push: true
tags: ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}:beta
cache-from: type=gha, ref=ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}-beta-build-cache
cache-to: type=gha, ref=ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }}-beta-build-cache, mode=max
tags: ghcr.io/${{ github.repository_owner }}/${{ env.DOCKER_REGISTRY_REPO_NAME }}:beta
cache-from: type=gha, ref=ghcr.io/${{ github.repository_owner }}/${{ env.DOCKER_REGISTRY_REPO_NAME }}-beta-build-cache
cache-to: type=gha, ref=ghcr.io/${{ github.repository_owner }}/${{ env.DOCKER_REGISTRY_REPO_NAME }}-beta-build-cache, mode=max

- name: copy files via ssh
uses: appleboy/scp-action@917f8b81dfc1ccd331fef9e2d61bdc6c8be94634 # v0.1.7
Expand All @@ -77,7 +80,7 @@ jobs:
key: ${{ secrets.VPS_OVH_BF7EC892_SSH_PRIVATE_KEY }}
passphrase: ${{ secrets.VPS_OVH_BF7EC892_SSH_PRIVATE_KEY_PASSPHRASE }}
source: "./environment/prod/deployment/beta/*,./environment/prod/deployment/scripts/*,./environment/prod/deployment/postgres/*"
target: ${{ secrets.KEATING_VPS_BETA_APP_PATH }}
target: ${{ env.TARGET_DIR_ON_SERVER }}/${{ env.DOCKER_REGISTRY_REPO_NAME }}
rm: true

- name: run deployment script over ssh
Expand All @@ -92,6 +95,6 @@ jobs:
passphrase: ${{ secrets.VPS_OVH_BF7EC892_SSH_PRIVATE_KEY_PASSPHRASE }}
script_stop: true
script: |
cd ${{ secrets.KEATING_VPS_BETA_APP_PATH }}/environment/prod/deployment/beta
cd ${{ env.TARGET_DIR_ON_SERVER }}/${{ env.DOCKER_REGISTRY_REPO_NAME }}/environment/prod/deployment/beta
make beta-deploy BETA_ENV_KEY=${{ secrets.BETA_ENV_KEY }}
docker images --filter dangling=true | grep "ghcr.io/blumilksoftware/${{ env.REPO_NAME }}" | awk '{print $3}'| xargs --no-run-if-empty docker rmi
docker images --filter dangling=true | grep "ghcr.io/blumilksoftware/${{ env.DOCKER_REGISTRY_REPO_NAME }}" | awk '{print $3}'| xargs --no-run-if-empty docker rmi

0 comments on commit b410168

Please sign in to comment.