created action for gauzy api stage on digitalOcean droplet #67
Workflow file for this run
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
name: Deploy to DigitalOcean Droplet Demo | |
on: | |
push: | |
branches: | |
- test-do-droplet2 | |
jobs: | |
deploy: | |
runs-on: buildjet-4vcpu-ubuntu-2204 | |
environment: demo | |
steps: | |
- name: checkout out code | |
uses: actions/checkout@v4 | |
- name: Globalise Ingress certificate type env | |
run: | | |
echo "INGRESS_CERT_TYPE=${{ env.INGRESS_CERT_TYPE }}" >> $GITHUB_ENV | |
env: | |
INGRESS_CERT_TYPE: 'letsencrypt' | |
- name: Generate TLS Secrets for DO Droplet | |
run: | | |
rm -f $GITHUB_WORKSPACE/.deploy/ssh/with-cloudflare/ingress.api.crt $GITHUB_WORKSPACE/.deploy/ssh/with-cloudflare/ingress.api.key | |
echo ${{ secrets.INGRESS_API_CERT }} | base64 --decode > $GITHUB_WORKSPACE/.deploy/ssh/with-cloudflare/ingress.api.crt | |
echo ${{ secrets.INGRESS_API_CERT_KEY }} | base64 --decode > $GITHUB_WORKSPACE/.deploy/ssh/with-cloudflare/ingress.api.key | |
- name: Copy file via scp | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{secrets.DO_DROPLET_DEMO_HOST}} | |
username: ${{secrets.DO_DROPLET_USERNAME}} | |
key: ${{secrets.DO_DROPLET_KEY}} | |
source: '.deploy/ssh/with-cloudflare/docker-compose.api.demo.cloudflare.pre.yml,.deploy/ssh/with-letsencrypt/demo/docker-compose.api.demo.letsencrypt.pre.yml,.deploy/ssh/with-cloudflare/nginx.demo.pre.cloudflare.conf,.deploy/ssh/with-letsencrypt/demo/user_conf.d,.deploy/ssh/with-letsencrypt/demo/nginx-certbot.env,.deploy/ssh/with-cloudflare/ingress.api.crt,.deploy/ssh/with-cloudflare/ingress.api.key' | |
target: '.' | |
- name: Deploy to DigitalOcean Droplet | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{secrets.DO_DROPLET_DEMO_HOST}} | |
username: ${{secrets.DO_DROPLET_USERNAME}} | |
key: ${{secrets.DO_DROPLET_KEY}} | |
script: | | |
if [ "${{ env.INGRESS_CERT_TYPE }}" = "cloudflare" ]; then | |
docker-compose -f .deploy/ssh/with-letsencrypt/demo/docker-compose.api.demo.letsencrypt.pre.yml down | |
docker-compose -f .deploy/ssh/with-cloudflare/docker-compose.api.demo.cloudflare.pre.yml up -d | |
elif [ "${{ env.INGRESS_CERT_TYPE }}" = "letsencrypt" ]; then | |
docker-compose -f .deploy/ssh/with-cloudflare/docker-compose.api.demo.cloudflare.pre.yml down | |
docker-compose -f .deploy/ssh/with-letsencrypt/demo/docker-compose.api.demo.letsencrypt.pre.yml up -d | |
else | |
echo "Unknown INGRESS_CERT_TYPE: $INGRESS_CERT_TYPE" | |
exit 1 | |
fi |