Repository navigation
46 lines (39 loc) · 1.41 KB
/
Copy pathdeploy.yml
File metadata and controls
46 lines (39 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: deploy
on:
push:
branches:
- main
jobs:
build-publish-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: repo # image repo name must be lowercase; https://github.com/orgs/community/discussions/25768
run: echo "name=${GITHUB_REPOSITORY@L}" >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v7
with:
context: .
push: true
tags: |
ghcr.io/${{ steps.repo.outputs.name }}:${{ github.ref_name }}
ghcr.io/${{ steps.repo.outputs.name }}:${{ github.sha }}
- name: deploy
run: |
install --directory --mode=700 ~/.ssh
install --mode=600 /dev/null ~/.ssh/id_ed25519
echo "${{ secrets.FOOR_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
echo "foor.raylu.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID05p9Iwshxedsw0ggneT0R3La6DFVFe8Igdb6Kaz/75" >> ~/.ssh/known_hosts
ssh xflasar@foor.raylu.net '
cd ~/PUNoted-API &&
git pull --ff-only &&
docker pull ghcr.io/${{ steps.repo.outputs.name }}:${{ github.ref_name }} &&
docker compose -f docker-compose.prod.yml up -d --no-deps backend
'