Skip to content

Production deployment #43

Production deployment

Production deployment #43

Workflow file for this run

name: Production deployment
on:
workflow_run:
workflows:
- "Build Docker Images"
branches:
- master
types:
- completed
jobs:
authenticate:
runs-on: ubuntu-latest
steps:
- name: Authenticate
env:
API_USERNAME: ${{ secrets.API_USERNAME }}
API_PASSWORD: ${{ secrets.API_PASSWORD }}
run: |
RESPONSE=$(curl -s -X POST "https://api.lambda.grail.moe/api/v1/login" \
-H "Content-Type: application/json" \
-d '{"username": "${{ env.API_USERNAME }}", "password": "${{ env.API_PASSWORD }}"}')
BODY=$(echo $RESPONSE | jq -r '.body')
JWT_TOKEN=$(echo $BODY | jq -r '.access_token')
echo "JWT_TOKEN=$JWT_TOKEN" > jwt.env
- name: Upload JWT Token as Artifact
uses: actions/upload-artifact@v2
with:
name: jwt-token
path: jwt.env
deploy:
needs: authenticate
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download JWT Token
uses: actions/download-artifact@v2
with:
name: jwt-token
path: .
- name: deploy
run: |
source jwt.env
curl -X GET "https://api.lambda.grail.moe/api/v1/deploy" \
-H "authorization: Bearer $JWT_TOKEN"