From dbb19c56aa857575024d720edd2335b13bef2bdf Mon Sep 17 00:00:00 2001 From: Ikhsan Satriadi Date: Sat, 20 Apr 2024 15:56:27 +0700 Subject: [PATCH] Create gh-pages.yml --- .github/workflows/gh-pages.yml | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/gh-pages.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000..742a80a --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,46 @@ +name: Github Pages + +on: + push: + branches: + - main + - master + pull_request: + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + steps: + - uses: actions/checkout@v4 + + - name: Setup Flutter + run: | + git clone https://github.com/flutter/flutter.git --depth 1 -b stable _flutter + echo "${GITHUB_WORKSPACE}/_flutter/bin" >> ${GITHUB_PATH} + + - name: Install + run: | + flutter config --enable-web + flutter pub get + + - name: Build + run: flutter build web --base-href "/${{ github.event.repository.name }}/" + + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + if: github.ref == 'refs/heads/master' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build/web + + - name: Deploy (Test) + uses: peaceiris/actions-gh-pages@v4 + if: github.ref != 'refs/heads/master' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build/web + publish_branch: gh-pages-test