Skip to content

Deploy to Production and Demo #144

Deploy to Production and Demo

Deploy to Production and Demo #144

name: Deploy to Production and Demo
concurrency: deploy_to_production
on:
- workflow_dispatch
env:
STAGING_ID: cc67ac7f-d41b-4a9c-a2ce-37f322690cb8
PRODUCTION_ID: c3364f4f-1d34-4b31-ac49-da9782159a7e
DEMO_ID: c87ff841-b900-4cc7-b3ea-19d29948be6e
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- uses: actions/setup-python@v4
- run: pip install yq
- name: Fetch spec files
run: |
doctl apps spec get $STAGING_ID > staging.yaml
doctl apps spec get $PRODUCTION_ID > production.yaml
doctl apps spec get $DEMO_ID > demo.yaml
- name: Update image tag
run: |
export TAG="$(python -m yq -r .services[0].image.tag staging.yaml)"
echo "Updating production image tag to $TAG"
python -m yq -Y --indentless --arg TAG "$TAG" --in-place '.services[0].image.tag = $TAG' production.yaml
python -m yq -Y --indentless --arg TAG "$TAG" --in-place '.services[0].image.tag = $TAG' demo.yaml
- name: Update the environments
run: |
doctl apps update $PRODUCTION_ID --spec production.yaml
doctl apps update $DEMO_ID --spec demo.yaml