Skip to content

Commit b6a978c

Browse files
authored
switch environment based on branch name
1 parent 82aae66 commit b6a978c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

.github/workflows/django.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ name: Django CI
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: [ "main", "staging" ]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: [ "main", "staging" ]
88

99
jobs:
1010
build:
11-
environment: production
11+
environment: ${{ github.ref_name }}
1212
name: "Deploy to production"
1313
runs-on: ubuntu-latest
1414
steps:
@@ -19,18 +19,18 @@ jobs:
1919
SSH_HOST: ${{ secrets.SSH_HOST }}
2020
run: |
2121
mkdir -p ~/.ssh/
22-
echo "$SSH_KEY" > ~/.ssh/production.key
23-
chmod 600 ~/.ssh/production.key
22+
echo "$SSH_KEY" > ~/.ssh/server.key
23+
chmod 600 ~/.ssh/server.key
2424
cat >>~/.ssh/config <<END
25-
Host production
25+
Host server
2626
HostName $SSH_HOST
2727
User $SSH_USER
28-
IdentityFile ~/.ssh/production.key
28+
IdentityFile ~/.ssh/server.key
2929
StrictHostKeyChecking no
3030
END
3131
- name: Deploy to Server
3232
run: |
33-
ssh production '
33+
ssh server '
3434
cd /home/django/bakeup/ &&
3535
git pull origin main &&
3636
source /home/django/djangoenv/bin/activate &&

0 commit comments

Comments
 (0)