From ef7d696f9d5dfabba04817d477a71c643ee3da86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Mon, 12 Dec 2022 13:46:03 +0100 Subject: [PATCH] Adjust cast deployment (#14651) * Adjust cast deployment * Handle dev/master builds * Consistant --- .github/workflows/cast_deployment.yaml | 90 ++++++++++++++++++++++++++ .github/workflows/netflify.yml | 15 ----- 2 files changed, 90 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/cast_deployment.yaml delete mode 100644 .github/workflows/netflify.yml diff --git a/.github/workflows/cast_deployment.yaml b/.github/workflows/cast_deployment.yaml new file mode 100644 index 0000000000..4634ae0136 --- /dev/null +++ b/.github/workflows/cast_deployment.yaml @@ -0,0 +1,90 @@ +name: Cast deployment + +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * *" + push: + branches: + - master + +env: + NODE_VERSION: 16 + NODE_OPTIONS: --max_old_space_size=6144 + +jobs: + deploy_dev: + runs-on: ubuntu-latest + name: Deploy Development + if: github.event_name != 'push' + environment: + name: Cast Development + url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }} + steps: + - name: Check out files from GitHub + uses: actions/checkout@v3 + with: + ref: dev + + - name: Set up Node ${{ env.NODE_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + cache: yarn + + - name: Install dependencies + run: yarn install + env: + CI: true + + - name: Build Cast + run: ./node_modules/.bin/gulp build-cast + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Deploy to Netlify + id: deploy + uses: netlify/actions/cli@master + with: + args: deploy --dir=cast/dist --alias dev + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_CAST_SITE_ID }} + + deploy_master: + runs-on: ubuntu-latest + name: Deploy Production + if: github.event_name == 'push' + environment: + name: Cast Production + url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }} + steps: + - name: Check out files from GitHub + uses: actions/checkout@v3 + with: + ref: master + + - name: Set up Node ${{ env.NODE_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + cache: yarn + + - name: Install dependencies + run: yarn install + env: + CI: true + + - name: Build Cast + run: ./node_modules/.bin/gulp build-cast + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Deploy to Netlify + id: deploy + uses: netlify/actions/cli@master + with: + args: deploy --dir=cast/dist --prod + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_CAST_SITE_ID }} \ No newline at end of file diff --git a/.github/workflows/netflify.yml b/.github/workflows/netflify.yml deleted file mode 100644 index fc554a813a..0000000000 --- a/.github/workflows/netflify.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Netlify - -on: - schedule: - - cron: "0 0 * * *" - -jobs: - trigger_builds: - name: Trigger netlify build preview - runs-on: "ubuntu-latest" - steps: - - name: Trigger Cast build - run: curl -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_CAST_DEV_BUILD_HOOK }} - -