Merge pull request #79 from dappforce/fix/CI #123
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: Build and only deploy backend | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- deploy/** | |
jobs: | |
back-build: | |
strategy: | |
matrix: | |
apps: [production, deploy] | |
isMaster: | |
- ${{ contains(github.ref, 'main') }} | |
isDeploy: | |
- ${{ startsWith(github.ref, 'refs/heads/deploy/') }} | |
exclude: | |
- isMaster: false | |
apps: production | |
- isMaster: true | |
apps: deploy | |
name: Build ${{ matrix.apps }} Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build ${{ matrix.apps }} image | |
uses: './.github/actions/common-ci-setup' | |
with: | |
username_input: ${{ secrets.DOCKER_USERNAME }} | |
password_input: ${{ secrets.DOCKER_PASSWORD }} | |
app_input: ${{ matrix.apps }} | |
back-deploy: | |
strategy: | |
matrix: | |
apps: [production, deploy] | |
isMaster: | |
- ${{ contains(github.ref, 'main') }} | |
isDeploy: | |
- ${{ startsWith(github.ref, 'refs/heads/deploy/') }} | |
exclude: | |
- isMaster: false | |
apps: production | |
- isMaster: true | |
apps: deploy | |
name: deploy ${{ matrix.apps }} | |
needs: back-build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: make prod ready | |
if: matrix.apps == 'production' | |
uses: './.github/actions/common-cd-setup' | |
with: | |
token_input: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN_PROD }} | |
k8s_input: ${{ secrets.K8S_PROD }} | |
app_input: ${{ matrix.apps }} | |
zone_input: ${{ secrets.CF_ZONE }} | |
mail_input: ${{ secrets.CF_MAIL }} | |
tokens_input: ${{ secrets.CF_TOKEN }} | |
prod_deploy: "false" | |
- name: stage deploy ${{ matrix.apps }} | |
if: matrix.apps == 'deploy' | |
uses: './.github/actions/common-cd-setup' | |
with: | |
token_input: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN_STAGING }} | |
k8s_input: ${{ secrets.K8S_STAGING }} | |
app_input: ${{ matrix.apps }} | |
zone_input: ${{ secrets.CF_ZONE }} | |
mail_input: ${{ secrets.CF_MAIL }} | |
tokens_input: ${{ secrets.CF_TOKEN }} | |
prod_deploy: "false" |