-
-
Notifications
You must be signed in to change notification settings - Fork 32
68 lines (63 loc) · 2.44 KB
/
snipsnap-templates-graphql.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
66
67
68
name: snipsnap-templates-graphql
on:
push:
branches: [master]
paths:
- templates/hasura/**
- templates/graphql/**
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Pixel Point Container Registry
uses: docker/login-action@v1
with:
registry: https://registry.pixelpoint.io
username: ${{ secrets.DOCKER_USERNAME}}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./templates/graphql
file: ./templates/graphql/Dockerfile.prod
push: true
tags: registry.pixelpoint.io/snipsnap-templates-graphql:latest
deploy:
runs-on: ubuntu-latest
needs: build
env:
KUBERNETES_URL: ${{ secrets.KUBERNETES_URL }}
KUBERNETES_TOKEN: ${{ secrets.KUBERNETES_TOKEN }}
steps:
- name: Pull deployment plugin
run: docker pull peloton/drone-k8s-deployment
# TODO: wrap Drone plugin as a Github action, have not found any available solutions
# in the marketplace that could just redeploy
- name: Deploy
run: |
docker run --rm -e PLUGIN_URL=$KUBERNETES_URL -e PLUGIN_TOKEN=$KUBERNETES_TOKEN -e PLUGIN_DEPLOYMENT_NAMES=templates-graphql -e PLUGIN_CONTAINER_NAMES=templates-graphql -e PLUGIN_NAMESPACES=snipsnap -e PLUGIN_DOCKER_IMAGE=registry.pixelpoint.io/snipsnap-templates-graphql:latest -e PLUGIN_DATE_LABEL=deployment.github/date-deployed peloton/drone-k8s-deployment
update-database:
runs-on: ubuntu-latest
needs: deploy
env:
WORKING_DIRECTORY: ./templates/hasura/
HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}
HASURA_GRAPHQL_ENDPOINT: ${{ secrets.HASURA_GRAPHQL_ENDPOINT }}
steps:
- uses: actions/checkout@v2
- name: Install Hasura CLI
run: sudo npm install -g hasura-cli@v2.0.0-alpha.10 --unsafe-perm=true
- name: Apply migrations
run: hasura migrate apply
working-directory: ${{env.WORKING_DIRECTORY}}
- name: Apply metadata
run: hasura metadata apply
working-directory: ${{env.WORKING_DIRECTORY}}