-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (56 loc) · 2.01 KB
/
deploy.yml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Deploy to prod when tag
on:
push:
tags:
- '*'
jobs:
deploy-prod:
name: Deploy to prod from ${{ github.ref_name }}/${{ github.sha }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Bump version in pyproject.toml and uv.lock to ${{ github.ref_name }}
run: |
sed -i 's/^ *version.*=.*"\([^"]*\)".*/version = "${{ github.ref_name }}"/' ./pyproject.toml
uv lock
- name: Commit and push updated pyproject.toml
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: "chore: bump version to ${{ github.ref_name }}"
commit_user_name: Adrien Carpentier
commit_user_email: [email protected]
commit_author: Adrien Carpentier <[email protected]>
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
name: id_rsa
known_hosts: ${{ secrets.SSH_HOST }}
- name: Adding known hosts
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Execute server commands for deploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/www/word-generator-api
git pull
/usr/local/bin/uv/bin/uv sync
sudo systemctl restart word-generator-api.service
- name: Create Sentry release
uses: getsentry/[email protected]
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: "adrien-carpentier"
SENTRY_PROJECT: "word-generator-api"
with:
environment: production
version: ${{ github.ref_name }}