Skip to content

Commit

Permalink
CI: Add check build (#284)
Browse files Browse the repository at this point in the history
* CI: Add check build

* CI: Add repo checker
  • Loading branch information
mazipan authored Oct 23, 2024
1 parent 406bb1f commit 21cf3f8
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 21cf3f8

Please sign in to comment.