diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b341e42..b7e92d2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,30 +3,39 @@ run-name: 🚀 Deploy on: workflow_run: workflows: ["build"] - branches: ["main"] + branches: ["main", "release/*"] types: - completed -permissions: - contents: write +env: + DEPLOY_PREVIEW: ${{ github.event.workflow_run.event == 'pull_request' }} + ARTIFACT_NAME: "build-artifact-${{ github.sha }}" + + jobs: deploy: - name: 🚀 Deploy + # Only run if the build was successful if: ${{ github.event.workflow_run.conclusion == 'success' }} + + name: 🚀 Deploy runs-on: ubuntu-latest - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v3 + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} - - name: 📦 Download Build Artifact - uses: actions/download-artifact@v2 - with: - name: "build-artifact-${{ github.sha }}" - path: build - - - name: 🔺 Publish our Build Artifacts - uses: actions/upload-pages-artifact@v2 + permissions: + pages: write + contents: write + id-token: write + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 with: - name: github-pages - path: build \ No newline at end of file + artifact_name: ${{ env.ARTIFACT_NAME}} + preview: ${{ env.DEPLOY_PREVIEW }} + + - name: Get the URL for the deployment + run: echo "${{ steps.deployment.outputs.page_url }}" \ No newline at end of file