Skip to content

Commit ef01ee7

Browse files
committed
cd pipeline
1 parent 7aae06a commit ef01ee7

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed
Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create and publish a Docker image
1+
name: Continuous Deployment
22

33
on:
44
push:
@@ -10,6 +10,7 @@ env:
1010

1111
jobs:
1212
build_image:
13+
name: Build Image
1314
runs-on: ubuntu-latest
1415
permissions:
1516
contents: read
@@ -45,4 +46,20 @@ jobs:
4546
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
4647
subject-digest: ${{ steps.push.outputs.digest }}
4748
push-to-registry: true
48-
49+
deploy:
50+
runs-on: ubuntu-latest
51+
name: Deploy
52+
steps:
53+
- name: Checkout repository
54+
uses: actions/checkout@v4
55+
- name: Setup SSH
56+
uses: appleboy/ssh-action@v1.2.1
57+
env:
58+
SECRETS_FILE: ${{ secrets.SECRETS }}
59+
with:
60+
host: ${{ secrets.SSH_HOST }}
61+
username: ${{ secrets.SSH_USERNAME }}
62+
key: ${{ secrets.SSH_KEY }}
63+
port: ${{ secrets.SSH_PORT }}
64+
envs: SECRETS_FILE
65+
script_path: deploy.sh

deploy.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
mkdir -p projects && cd projects
4+
5+
if [ -d "common-game" ]; then
6+
cd common-game
7+
git pull
8+
else
9+
git checkout https://github.com/cg219/common-game.git common-game
10+
cd common-game
11+
fi
12+
13+
echo $SECRETS_FILE > secrets.yaml
14+
docker stack deploy -c stack.yaml commongame

0 commit comments

Comments
 (0)