diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..5fc150f113 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: Check build + +on: + workflow_dispatch: + pull_request: + types: [synchronize] + branches: + - 'master' + +jobs: + check_build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + fetch-depth: 0 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: false + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Build project + env: + PUBLIC_FIREBASE_API_KEY: ${{ secrets.PUBLIC_FIREBASE_API_KEY }} + PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.PUBLIC_FIREBASE_AUTH_DOMAIN }} + PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.PUBLIC_FIREBASE_PROJECT_ID }} + PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.PUBLIC_FIREBASE_STORAGE_BUCKET }} + PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.PUBLIC_FIREBASE_MESSAGING_SENDER_ID }} + PUBLIC_FIREBASE_APP_ID: ${{ secrets.PUBLIC_FIREBASE_APP_ID }} + PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.PUBLIC_FIREBASE_MEASUREMENT_ID }} + run: | + pnpm run build + touch build/.nojekyll diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 99920dabc7..b3ab2c2421 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -59,6 +59,8 @@ jobs: touch build/.nojekyll - name: Fix permissions + # Only run this on forked repo in mazipan-quran-offline + if: github.repository == 'mazipan-quran-offline/baca-quran.id' run: | chmod -c -R +rX "build/" | while read line; do echo "::warning title=Invalid file permissions automatically fixed::$line" @@ -85,6 +87,8 @@ jobs: # token: ${{ secrets.PERSONAL_TOKEN }} - name: Commit generated files only + # Only run this on forked repo in mazipan-quran-offline + if: github.repository == 'mazipan-quran-offline/baca-quran.id' run: | echo "> Start remove unused files..." rm -rf .github/workflows .svelte-kit markdowns screenshoot scripts static src node_modules @@ -105,6 +109,8 @@ jobs: - name: Push changes uses: ad-m/github-push-action@master + # Only run this on forked repo in mazipan-quran-offline + if: github.repository == 'mazipan-quran-offline/baca-quran.id' with: repository: mazipan-quran-offline/mazipan-quran-offline.github.io force: true