next try
This commit is contained in:
@@ -31,6 +31,7 @@ jobs:
|
||||
echo "tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
|
||||
echo "env=$ENVIRONMENT" >> $GITHUB_OUTPUT
|
||||
echo "Image tag will be: $IMAGE_TAG"
|
||||
echo "env will be: $ENVIRONMENT"
|
||||
|
||||
- name: Build and push image
|
||||
id: docker_build
|
||||
@@ -51,6 +52,17 @@ jobs:
|
||||
echo "url=$URL" >> $GITHUB_OUTPUT
|
||||
echo "URL will be: $URL"
|
||||
|
||||
- name: Setup SSH
|
||||
uses: webfactory/ssh-agent@v0.9.1
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.SSH_DEPLOYMENT_KEY }}
|
||||
|
||||
- name: Add SSH host to known hosts
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
ssh-keyscan -p ${{ vars.ssh_port }} ${{ vars.ssh_host }} >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Create environment file
|
||||
run: |
|
||||
cat > .env << EOF
|
||||
@@ -70,9 +82,6 @@ jobs:
|
||||
- name: Create Docker context
|
||||
run: 'docker context create deploy_target --docker "host=ssh://${{ vars.ssh_user }}@${{ vars.ssh_host }}:${{ vars.ssh_port }}"'
|
||||
|
||||
- name: Validate Docker context
|
||||
run: 'docker --context deploy_target info'
|
||||
|
||||
- name: Stop existing deployment
|
||||
run: |
|
||||
DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.image_tag.outputs.env }} down --remove-orphans || true
|
||||
|
||||
Reference in New Issue
Block a user