Created
February 18, 2023 15:09
-
-
Save VishwaiOSDev/5f708012bc807c58297f937bbfabad9d to your computer and use it in GitHub Desktop.
This is a GitHub Actions workflow called "Deploy" that automatically deploys a Swift Vapor API to a remote server whenever code is pushed to the main branch (ignoring changes to markdown files).
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
name: Deploy | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
env: | |
HOST: ${{ secrets.HOST }} | |
USERNAME: ${{ secrets.USERNAME }} | |
SSHKEY: ${{ secrets.SSHKEY }} | |
PORT: ${{ secrets.PORT }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ env.HOST }} | |
username: ${{ env.USERNAME }} | |
key: ${{ env.SSHKEY }} | |
port: ${{ env.PORT }} | |
script: | | |
whoami | |
cd /root/swift/IP2GeoVapor | |
git reset --hard | |
git pull --force | |
docker stop vaporAPI || true | |
docker rm vaporAPI || true | |
docker build . -t ip2geo-vapor | |
docker run -d --name vaporAPI -p 3001:3001 ip2geo-vapor | |
docker image prune -a --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment