Skip to content

Commit 93c2bfc

Browse files
committed
migrations workflows
1 parent a6d1dcd commit 93c2bfc

File tree

4 files changed

+102
-2
lines changed

4 files changed

+102
-2
lines changed

.github/workflows/deploy.yml

-2
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,3 @@ jobs:
3232
contents: read
3333
actions: write
3434
id-token: write
35-
36-

.github/workflows/migratedown.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: MigrateDown
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
12+
- name: SSH and run commands
13+
env:
14+
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY}}
15+
run: |
16+
# copy SSH private key and set rights
17+
echo "$PRIVATE_KEY" > private_key.pem
18+
chmod 600 private_key.pem
19+
20+
# connect to server
21+
ssh -o StrictHostKeyChecking=no -i private_key.pem [email protected] <<EOF
22+
23+
cd ~/newella/newella-backend
24+
git checkout main
25+
git pull
26+
make migrateDown
27+
28+
EOF
29+
30+
rm -f private_key.pem
31+
permissions:
32+
contents: read
33+
actions: write
34+
id-token: write

.github/workflows/migratedrop.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: MigrateDrop
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
12+
- name: SSH and run commands
13+
env:
14+
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY}}
15+
run: |
16+
# copy SSH private key and set rights
17+
echo "$PRIVATE_KEY" > private_key.pem
18+
chmod 600 private_key.pem
19+
20+
# connect to server
21+
ssh -o StrictHostKeyChecking=no -i private_key.pem [email protected] <<EOF
22+
23+
cd ~/newella/newella-backend
24+
git checkout main
25+
git pull
26+
make migrateDrop
27+
28+
EOF
29+
30+
rm -f private_key.pem
31+
permissions:
32+
contents: read
33+
actions: write
34+
id-token: write

.github/workflows/migrateup.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: MigrateUp
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
12+
- name: SSH and run commands
13+
env:
14+
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY}}
15+
run: |
16+
# copy SSH private key and set rights
17+
echo "$PRIVATE_KEY" > private_key.pem
18+
chmod 600 private_key.pem
19+
20+
# connect to server
21+
ssh -o StrictHostKeyChecking=no -i private_key.pem [email protected] <<EOF
22+
23+
cd ~/newella/newella-backend
24+
git checkout main
25+
git pull
26+
make migrateUp
27+
28+
EOF
29+
30+
rm -f private_key.pem
31+
permissions:
32+
contents: read
33+
actions: write
34+
id-token: write

0 commit comments

Comments
 (0)