-
Notifications
You must be signed in to change notification settings - Fork 6
54 lines (47 loc) · 1.92 KB
/
run-migrations-dev.yaml
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
on: workflow_dispatch
name: Run desci-server migrations (DEV)
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
env:
AWS_DEFAULT_REGION: us-east-2
AWS_DEFAULT_OUTPUT: json
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CONTAINER_IMAGE: desci-server
DOCKER_BUILDKIT: 1
jobs:
migrate:
name: Migrate database (DEV)
runs-on: ubuntu-latest
steps:
# Add steps here like linting, testing, minification, etc.
- id: install-aws-cli
uses: unfor19/install-aws-cli-action@v1
with:
version: 1
workdir: ${{ runner.temp }}/aws_cli_install
rootdir: ${{ runner.temp }}/aws_cli
installrootdir: ${{ runner.temp }}/aws
- name: Add AWS tools to PATH
run: |
echo "${{ runner.temp }}/aws/bin" >> $GITHUB_PATH
echo "${{ runner.temp }}/aws_cli/bin" >> $GITHUB_PATH
- uses: prepor/action-aws-iam-authenticator@master
- run: aws-iam-authenticator version
- name: Install Kubectl
run: |
#$(curl -Ls https://dl.k8s.io/release/stable.txt)
version=v1.23.6
echo "using kubectl@$version"
curl -sLO "https://dl.k8s.io/release/$version/bin/linux/amd64/kubectl" -o kubectl
chmod +x kubectl
mv kubectl /usr/local/bin
mkdir $HOME/.kube
sudo apt-get update
sudo apt-get install less
echo ${{ secrets.KUBE_CONFIG_DATA }} | base64 --decode > $HOME/.kube/config
aws sts get-caller-identity
- name: Migrate DB (DEV)
if: github.ref == 'refs/heads/develop'
run: |
kubectl exec -it $(kubectl get pods -l App=DesciServerDev -o jsonpath="{.items[0].metadata.name}") --container desci-server-dev -- bash -c "source /vault/secrets/config && npx prisma migrate deploy"