Skip to content

Merge pull request #1097 from gmmcal/reusable #807

Merge pull request #1097 from gmmcal/reusable

Merge pull request #1097 from gmmcal/reusable #807

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
schedule:
- cron: "0 0 * * 0"
release:
types: [published]
jobs:
docker_production:
name: 'Docker: Production'
runs-on: ubuntu-20.04
if: github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build test image
uses: docker/build-push-action@v5
with:
push: true
context: .
target: production
tags: "gmmcal/gmmcal:latest"
cache-from: type=registry,ref=gmmcal/gmmcal:buildcache
cache-to: type=registry,ref=gmmcal/gmmcal:buildcache,mode=max
docker_development:
name: 'Docker: Development'
runs-on: ubuntu-20.04
if: github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build test image
uses: docker/build-push-action@v5
with:
push: true
context: .
target: development
tags: "gmmcal/gmmcal:development"
cache-from: type=registry,ref=gmmcal/gmmcal:buildcache
cache-to: type=registry,ref=gmmcal/gmmcal:buildcache,mode=max
staging:
name: 'Deploy: Staging'
runs-on: ubuntu-20.04
if: github.event_name == 'push'
steps:
- name: Deploy
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY_STAGING }}
DEPLOY_SERVICE: ${{ secrets.DEPLOY_SERVICE_STAGING }}
run: |
curl -v "https://api.render.com/deploy/srv-$DEPLOY_SERVICE?key=$DEPLOY_KEY&ref=$GITHUB_SHA"
production:
name: 'Deploy: Production'
runs-on: ubuntu-20.04
if: github.event_name != 'push'
steps:
- name: Deploy
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY_PRODUCTION }}
DEPLOY_SERVICE: ${{ secrets.DEPLOY_SERVICE_PRODUCTION }}
run: |
curl -v "https://api.render.com/deploy/srv-$DEPLOY_SERVICE?key=$DEPLOY_KEY&ref=$GITHUB_SHA"