Skip to content

πŸ“¦ Continuous Deployment #1

πŸ“¦ Continuous Deployment

πŸ“¦ Continuous Deployment #1

Workflow file for this run

on:
workflow_dispatch:
push:
tags:
- "*"
name: πŸ“¦ Continuous Deployment
jobs:
cd:
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@v3
- name: πŸ‹ Setup Buildx
uses: docker/setup-buildx-action@v3
- name: πŸ” Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: ⏳ Wait for Continuous Integration
uses: lewagon/[email protected]
with:
check-name: "ci"
wait-interval: 10
ref: ${{ github.ref }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: πŸ—οΈ Build and Publish
run: |
docker buildx build -t banking-frontend:${{ github.ref_name }} -t banking-frontend:latest -f docker/Dockerfile --load .
docker image tag banking-frontend ghcr.io/simplytest/banking-frontend
docker push -a ghcr.io/simplytest/banking-frontend
- name: πŸ“¦ Deploy
uses: appleboy/ssh-action@55dabf81b49d4120609345970c91507e2d734799
with:
host: ${{ secrets.HOST }}
port: ${{ secrets.PORT }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
docker stop Banking-Frontend-Demo || true
docker rm Banking-Frontend-Demo || true
docker pull ghcr.io/simplytest/banking-frontend:latest
docker run -d -p 4200:80 --rm --name=Banking-Frontend-Demo ghcr.io/simplytest/banking-frontend:latest