From 995145cccc09f412524a9ad13936601f5bd72c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C4=8Cerm=C3=A1k?= Date: Fri, 22 Nov 2024 10:27:33 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20GitHub=20Action?= =?UTF-8?q?s=20workflows=20to=20use=20inputs=20instead=20of=20secrets=20fo?= =?UTF-8?q?r=20Vercel=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/preview-common.yaml | 13 ++++++++----- .github/workflows/preview.yaml | 11 ++--------- .github/workflows/production-common.yaml | 13 ++++++++----- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.github/workflows/preview-common.yaml b/.github/workflows/preview-common.yaml index 743bbb5..69f44fe 100644 --- a/.github/workflows/preview-common.yaml +++ b/.github/workflows/preview-common.yaml @@ -2,13 +2,16 @@ name: Reusable Preview Workflow on: workflow_call: - secrets: + inputs: vercel_project_name: required: true + type: string vercel_scope: required: true + type: string vercel_token: required: true + type: string jobs: shared-steps: @@ -26,13 +29,13 @@ jobs: run: corepack install - name: Link Project to Vercel - run: yarn dlx -q vercel link --project=${{ secrets.vercel_project_name }} --scope=${{ secrets.vercel_scope }} --yes --token=${{ secrets.vercel_token }} + run: yarn dlx -q vercel link --project=${{ inputs.vercel_project_name }} --scope=${{ inputs.vercel_scope }} --yes --token=${{ inputs.vercel_token }} - name: Pull Vercel Environment Information - run: yarn dlx -q vercel pull --yes --environment=preview --token=${{ secrets.vercel_token }} + run: yarn dlx -q vercel pull --yes --environment=preview --token=${{ inputs.vercel_token }} - name: Build Project Artifacts - run: yarn dlx -q vercel build --token=${{ secrets.vercel_token }} + run: yarn dlx -q vercel build --token=${{ inputs.vercel_token }} - name: Deploy Project Artifacts to Vercel - run: yarn dlx -q vercel deploy --prebuilt --token=${{ secrets.vercel_token }} + run: yarn dlx -q vercel deploy --prebuilt --token=${{ inputs.vercel_token }} diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 97c3696..2ddc3c4 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -5,24 +5,17 @@ on: branches: - dev -env: - VERCEL_NAME_EXAMPLE_DEFAULT: ${{ secrets.VERCEL_NAME_EXAMPLE_DEFAULT }} - VERCEL_NAME_EXAMPLE_UPGRADE: ${{ secrets.VERCEL_NAME_EXAMPLE_UPGRADE }} - VERCEL_SCOPE: ${{ secrets.VERCEL_SCOPE }} - VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - jobs: default-example: uses: ./.github/workflows/preview-common.yaml - secrets: + with: vercel_project_name: ${{ secrets.VERCEL_NAME_EXAMPLE_DEFAULT }} vercel_scope: ${{ secrets.VERCEL_SCOPE }} vercel_token: ${{ secrets.VERCEL_TOKEN }} upgrade-example: uses: ./.github/workflows/preview-common.yaml - secrets: + with: vercel_token: ${{ secrets.VERCEL_TOKEN }} vercel_project_name: ${{ secrets.VERCEL_NAME_EXAMPLE_UPGRADE }} vercel_scope: ${{ secrets.VERCEL_SCOPE }} diff --git a/.github/workflows/production-common.yaml b/.github/workflows/production-common.yaml index a09d581..bd5f432 100644 --- a/.github/workflows/production-common.yaml +++ b/.github/workflows/production-common.yaml @@ -2,13 +2,16 @@ name: Reusable Production Workflow on: workflow_call: - secrets: + inputs: vercel_project_name: required: true + type: string vercel_scope: required: true + type: string vercel_token: required: true + type: string jobs: shared-steps: @@ -26,13 +29,13 @@ jobs: run: corepack install - name: Link Project to Vercel - run: yarn dlx -q vercel link --project=${{ secrets.vercel_project_name }} --scope=${{ secrets.vercel_scope }} --yes --token=${{ secrets.vercel_token }} + run: yarn dlx -q vercel link --project=${{ inputs.vercel_project_name }} --scope=${{ inputs.vercel_scope }} --yes --token=${{ inputs.vercel_token }} - name: Pull Vercel Environment Information - run: yarn dlx -q vercel pull --yes --environment=production --token=${{ secrets.vercel_scope }} + run: yarn dlx -q vercel pull --yes --environment=production --token=${{ inputs.vercel_scope }} - name: Build Project Artifacts - run: yarn dlx -q vercel build --prod --token=${{ secrets.vercel_token }} + run: yarn dlx -q vercel build --prod --token=${{ inputs.vercel_token }} - name: Deploy Project Artifacts to Vercel - run: yarn dlx -q vercel deploy --prebuilt --prod --token=${{ secrets.vercel_token }} + run: yarn dlx -q vercel deploy --prebuilt --prod --token=${{ inputs.vercel_token }}