diff --git a/.github/workflows/deploy-examples.yml b/.github/workflows/deploy-examples.yml new file mode 100644 index 0000000..13a8e8f --- /dev/null +++ b/.github/workflows/deploy-examples.yml @@ -0,0 +1,31 @@ +on: + workflow_call: + inputs: + environment: + required: true + type: string + isProd: + required: true + type: boolean + +jobs: + deploy_timeaxis: + uses: ./.github/workflows/deploy.yml + with: + environment: ${{ inputs.environment }} - dnd-timeline-timeaxis + isProd: ${{ inputs.isProd }} + secrets: inherit + + deploy_performance: + uses: ./.github/workflows/deploy.yml + with: + environment: ${{ inputs.environment }} - dnd-timeline-performance + isProd: ${{ inputs.isProd }} + secrets: inherit + + deploy_demo: + uses: ./.github/workflows/deploy.yml + with: + environment: ${{ inputs.environment }} - dnd-timeline-demo + isProd: ${{ inputs.isProd }} + secrets: inherit diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml new file mode 100644 index 0000000..d7360ee --- /dev/null +++ b/.github/workflows/deploy-preview.yml @@ -0,0 +1,11 @@ +name: Production - Deploy dnd-timeline examples +on: + pull_request: + types: [opened, synchronize] + +jobs: + deploy_production: + uses: ./.github/workflows/deploy-examples.yml + with: + environment: Preview + secrets: inherit diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml new file mode 100644 index 0000000..e27cea2 --- /dev/null +++ b/.github/workflows/deploy-production.yml @@ -0,0 +1,13 @@ +name: Production - Deploy dnd-timeline examples +on: + push: + branches: + - main + +jobs: + deploy_production: + uses: ./.github/workflows/deploy-examples.yml + with: + environment: Production + isProd: true + secrets: inherit diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0482a09..4e1ef31 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,9 +9,12 @@ on: environment: required: true type: string + isProd: + type: boolean + default: false jobs: - deploy_production: + deploy: runs-on: ubuntu-latest environment: name: ${{ inputs.environment }} @@ -24,4 +27,4 @@ jobs: run: npm install --global vercel@latest - name: Deploy to Vercel id: deploy - run: echo "url=$(vercel --prod --yes --token=${{ secrets.VERCEL_TOKEN }})" >> "$GITHUB_OUTPUT" + run: echo "url=$(vercel --prod=${{ inputs.isProd }} --yes --token=${{ secrets.VERCEL_TOKEN }})" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index f0ac3fd..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Deploy dnd-timeline examples -on: - push: - branches: - - main - -jobs: - deploy_timeaxis: - uses: ./.github/workflows/deploy.yml - with: - environment: Production - dnd-timeline-timeaxis - secrets: inherit - - deploy_performance: - uses: ./.github/workflows/deploy.yml - with: - environment: Production - dnd-timeline-performance - secrets: inherit - - deploy_demo: - uses: ./.github/workflows/deploy.yml - with: - environment: Production - dnd-timeline-demo - secrets: inherit