69 lines
2.0 KiB
YAML
69 lines
2.0 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: ["main", "**"]
|
|
delete:
|
|
|
|
env:
|
|
PANGOLIN_API_URL: ${{ secrets.PANGOLIN_API_URL }}
|
|
PANGOLIN_API_KEY: ${{ secrets.PANGOLIN_API_KEY }}
|
|
PANGOLIN_ORG_ID: ${{ secrets.PANGOLIN_ORG_ID }}
|
|
PANGOLIN_DOMAIN_ID: ${{ secrets.PANGOLIN_DOMAIN_ID }}
|
|
PANGOLIN_SITE_ID: ${{ secrets.PANGOLIN_SITE_ID }}
|
|
PANGOLIN_TARGET_IP: ${{ secrets.PANGOLIN_TARGET_IP }}
|
|
|
|
jobs:
|
|
deploy-production:
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: https://git.zyrrus.dev/eighty-six/node-deploy-action/deploy@v1
|
|
with:
|
|
app-name: ${{ vars.APP_NAME }}
|
|
tag: production
|
|
port: ${{ vars.PROD_PORT }}
|
|
environment: production
|
|
subdomain: ${{ vars.PROD_SUBDOMAIN }}
|
|
|
|
deploy-preview:
|
|
if: github.event_name == 'push' && github.ref != 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Compute preview slug
|
|
id: slug
|
|
uses: https://git.zyrrus.dev/eighty-six/node-deploy-action/slug@v1
|
|
with:
|
|
branch: ${{ github.ref_name }}
|
|
|
|
- uses: https://git.zyrrus.dev/eighty-six/node-deploy-action/deploy@v1
|
|
with:
|
|
app-name: ${{ vars.APP_NAME }}
|
|
tag: ${{ steps.slug.outputs.slug }}
|
|
port: ${{ steps.slug.outputs.port }}
|
|
environment: preview
|
|
subdomain: ${{ steps.slug.outputs.slug }}.${{ vars.APP_NAME }}
|
|
|
|
cleanup-preview:
|
|
if: github.event_name == 'delete' && github.event.ref_type == 'branch'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Compute preview slug
|
|
id: slug
|
|
uses: https://git.zyrrus.dev/eighty-six/node-deploy-action/slug@v1
|
|
with:
|
|
branch: ${{ github.event.ref }}
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: main
|
|
|
|
- uses: https://git.zyrrus.dev/eighty-six/node-deploy-action/cleanup@v1
|
|
with:
|
|
app-name: ${{ vars.APP_NAME }}
|
|
slug: ${{ steps.slug.outputs.slug }}
|