From 21e97050960e85c47450f1f9609ce3d4b8c99240 Mon Sep 17 00:00:00 2001 From: Sachsenspielt Date: Tue, 10 Oct 2023 19:14:57 +0200 Subject: [PATCH] ci: updated netlify deployment --- .github/workflows/branch-deploy.yml | 4 ++-- .github/workflows/pr-deploy.yml | 36 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/pr-deploy.yml diff --git a/.github/workflows/branch-deploy.yml b/.github/workflows/branch-deploy.yml index 30cff520..5b83481b 100644 --- a/.github/workflows/branch-deploy.yml +++ b/.github/workflows/branch-deploy.yml @@ -26,8 +26,8 @@ jobs: uses: nwtgck/actions-netlify@v2.0 with: publish-dir: build/web - production-branch: ${{ github.ref }} - deploy-message: 'GH-ACTIONS: Deploy of branch ${{ github.ref }}' + production-branch: ${{ github.ref_name }} + deploy-message: 'GH-ACTIONS: Deploy of branch ${{ github.ref_name }}' enable-commit-status: true github-token: ${{ secrets.GITHUB_TOKEN }} production-deploy: false diff --git a/.github/workflows/pr-deploy.yml b/.github/workflows/pr-deploy.yml new file mode 100644 index 00000000..d3c21fb9 --- /dev/null +++ b/.github/workflows/pr-deploy.yml @@ -0,0 +1,36 @@ +name: Deploy Branch to Netlify + +on: + pull_request: + +jobs: + build-web: + name: Build Web + runs-on: ubuntu-latest + steps: + - name: Code Checkout + uses: actions/checkout@v3 + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + + - name: Get Packages + run: flutter pub get + + - name: Build Web + run: flutter build web + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v2.0 + with: + publish-dir: build/web + production-branch: ${{ github.head_ref }} + "-" + ${{ github.sha }} + deploy-message: 'GH-ACTIONS: Deploy of PR from ${{ github.head_ref }}' + enable-commit-status: true + github-token: ${{ secrets.GITHUB_TOKEN }} + production-deploy: false + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}