diff --git a/.github/workflows/build.yml b/.github/workflows/build-and-deploy.yml similarity index 52% rename from .github/workflows/build.yml rename to .github/workflows/build-and-deploy.yml index fd8cf49..604a93d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-and-deploy.yml @@ -1,5 +1,5 @@ -name: build -run-name: 🏗️ Build +name: build-and-deploy +run-name: 🏗️ CI/CD on: push: branches: @@ -39,3 +39,29 @@ jobs: with: name: "build-artifact-${{ github.sha }}" path: build + + deploy: + if: ${{ github.ref == 'refs/heads/master' }} + needs: [build] + + name: 🚀 Deploy + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + permissions: + pages: write + contents: write + id-token: write + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + with: + artifact_name: "build-artifact-${{ github.sha }}" + preview: false + + - name: Get the URL for the deployment + run: echo "${{ steps.deployment.outputs.page_url }}" \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index e36b7e5..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: deploy -run-name: 🚀 Deploy - -on: - workflow_run: - workflows: [build] - branches: [master] - types: - - completed - -jobs: - deploy: - # Only run if the build was successful - if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/master' }} - name: 🚀 Deploy - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - permissions: - pages: write - contents: write - id-token: write - - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 - with: - artifact_name: "build-artifact-${{ github.sha }}" - preview: false - - - name: Get the URL for the deployment - run: echo "${{ steps.deployment.outputs.page_url }}" \ No newline at end of file