Run desci-server migrations (DEV) #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- 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 | |
kubectl describe deployments | |
- 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}") -- source /vault/secrets/config && npx prisma migrate deploy |