π¦ Continuous Deployment #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |