From 52a096b44f267e6d9798927af5f794d5867e2a2e Mon Sep 17 00:00:00 2001 From: attajak Date: Mon, 2 Mar 2026 14:18:17 +0700 Subject: [PATCH 1/3] Fix deploy workflows --- .github/workflows/deploy-live.yml | 15 +++- .github/workflows/deploy-preview.yml | 14 ++- .github/workflows/live.yml | 130 --------------------------- .github/workflows/preview.yml | 107 ---------------------- 4 files changed, 24 insertions(+), 242 deletions(-) delete mode 100644 .github/workflows/live.yml delete mode 100644 .github/workflows/preview.yml diff --git a/.github/workflows/deploy-live.yml b/.github/workflows/deploy-live.yml index 109ec29..c5dddcb 100644 --- a/.github/workflows/deploy-live.yml +++ b/.github/workflows/deploy-live.yml @@ -36,7 +36,7 @@ defaults: run: shell: bash jobs: - build_and_deploy: + build: runs-on: ubuntu-latest env: DART_SASS_VERSION: 1.97.3 @@ -111,8 +111,17 @@ jobs: with: path: ${{ runner.temp }}/hugo_cache key: ${{ steps.cache-restore.outputs.cache-primary-key }} - - name: Firebase Hosting Deploy To Live Channel - id: deployment + + deploy_live: + environment: + name: production + run-on: ubuntu-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Deploy To Live Channel + id: live uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index 5af288c..2be2674 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -4,6 +4,7 @@ permissions: checks: write contents: read id-token: write + pages: write pull-requests: write concurrency: group: pages @@ -12,7 +13,7 @@ defaults: run: shell: bash jobs: - build_and_preview: + build: if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest env: @@ -88,7 +89,16 @@ jobs: with: path: ${{ runner.temp }}/hugo_cache key: ${{ steps.cache-restore.outputs.cache-primary-key }} - - name: Firebase Hosting Deploy To Preview Channel + + deploy_preview: + environment: + name: preview + run-on: ubuntu-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Deploy To Preview Channel id: preview uses: FirebaseExtended/action-hosting-deploy@v0 with: diff --git a/.github/workflows/live.yml b/.github/workflows/live.yml deleted file mode 100644 index 1a359d2..0000000 --- a/.github/workflows/live.yml +++ /dev/null @@ -1,130 +0,0 @@ -name: Build and deploy to Firebase Hosting -on: - # schedule: - # Rebuid the site every day at 00:00 UTC to update the projects data - # - cron: '0 0 * * *' - push: - branches: - - main - paths: - - '.github/workflows/**' - - 'assets/**' - - 'config/**' - - 'content/**' - - 'data/**' - - 'i18n/**' - - 'layouts/**' - - 'static/**' - - 'themes/**' - - 'hugo.*' - - 'config.*' - - 'go.*' - - 'firebase.json' - workflow_run: - workflows: ['Update modules'] - types: - - completed - workflow_dispatch: -permissions: - contents: read - pages: write - id-token: write -concurrency: - group: pages - cancel-in-progress: false -defaults: - run: - shell: bash -jobs: - build: - runs-on: ubuntu-latest - env: - DART_SASS_VERSION: 1.97.3 - GO_VERSION: 1.26.0 - HUGO_VERSION: 0.157.0 - NODE_VERSION: 24.14.0 - TZ: Asia/Bangkok - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - submodules: true - fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@v6 - with: - go-version: ${{ env.GO_VERSION }} - cache: false - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Setup Pages - id: pages - uses: actions/configure-pages@v5 - - name: Create directory for user-specific executable files - run: | - mkdir -p "${HOME}/.local" - - name: Install Dart Sass - run: | - curl -sLJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" - tar -C "${HOME}/.local" -xf "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" - rm "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" - echo "${HOME}/.local/dart-sass" >> "${GITHUB_PATH}" - - name: Install Hugo - run: | - curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" - mkdir "${HOME}/.local/hugo" - tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" - rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" - echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}" - - name: Verify installations - run: | - echo "Dart Sass: $(sass --version)" - echo "Go: $(go version)" - echo "Hugo: $(hugo version)" - echo "Node.js: $(node --version)" - - name: Install Node.js dependencies - run: | - [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true - - name: Configure Git - run: | - git config core.quotepath false - - name: Cache restore - id: cache-restore - uses: actions/cache/restore@v5 - with: - path: ${{ runner.temp }}/hugo_cache - key: hugo-${{ github.run_id }} - restore-keys: - hugo- - - name: Build the site - run: | - hugo \ - --gc \ - --minify \ - --logLevel info \ - --cacheDir "${{ runner.temp }}/hugo_cache" - - name: Cache save - id: cache-save - uses: actions/cache/save@v5 - with: - path: ${{ runner.temp }}/hugo_cache - key: ${{ steps.cache-restore.outputs.cache-primary-key }} -jobs: - deploy_live: - environment: - name: production - run-on: ubuntu-latest - needs: build - steps: - - name: Checkout - uses: actions/checkout@v6 - - name: Deploy To Live Channel - id: live - uses: FirebaseExtended/action-hosting-deploy@v0 - with: - repoToken: ${{ secrets.GITHUB_TOKEN }} - firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_ATTAJAK }} - channelId: live - projectId: attajak diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml deleted file mode 100644 index 08bfe58..0000000 --- a/.github/workflows/preview.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: Build and Deploy to Firebase Hosting on PR -on: pull_request -permissions: - checks: write - contents: read - id-token: write - pull-requests: write -concurrency: - group: pages - cancel-in-progress: false -defaults: - run: - shell: bash -jobs: - build: - if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} - runs-on: ubuntu-latest - env: - DART_SASS_VERSION: 1.97.3 - GO_VERSION: 1.26.0 - HUGO_VERSION: 0.157.0 - NODE_VERSION: 24.14.0 - TZ: Asia/Bangkok - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - submodules: true - fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@v6 - with: - go-version: ${{ env.GO_VERSION }} - cache: false - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Setup Pages - id: pages - uses: actions/configure-pages@v5 - - name: Create directory for user-specific executable files - run: | - mkdir -p "${HOME}/.local" - - name: Install Dart Sass - run: | - curl -sLJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" - tar -C "${HOME}/.local" -xf "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" - rm "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" - echo "${HOME}/.local/dart-sass" >> "${GITHUB_PATH}" - - name: Install Hugo - run: | - curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" - mkdir "${HOME}/.local/hugo" - tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" - rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" - echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}" - - name: Verify installations - run: | - echo "Dart Sass: $(sass --version)" - echo "Go: $(go version)" - echo "Hugo: $(hugo version)" - echo "Node.js: $(node --version)" - - name: Install Node.js dependencies - run: | - [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true - - name: Configure Git - run: | - git config core.quotepath false - - name: Cache restore - id: cache-restore - uses: actions/cache/restore@v5 - with: - path: ${{ runner.temp }}/hugo_cache - key: hugo-${{ github.run_id }} - restore-keys: - hugo- - - name: Build the site - run: | - hugo \ - --gc \ - --minify \ - --logLevel info \ - --cacheDir "${{ runner.temp }}/hugo_cache" - - name: Cache save - id: cache-save - uses: actions/cache/save@v5 - with: - path: ${{ runner.temp }}/hugo_cache - key: ${{ steps.cache-restore.outputs.cache-primary-key }} -jobs: - deploy_preview: - environment: - name: preview - run-on: ubuntu-latest - needs: build - steps: - - name: Checkout - uses: actions/checkout@v6 - - name: Deploy To Preview Channel - id: preview - uses: FirebaseExtended/action-hosting-deploy@v0 - with: - repoToken: ${{ secrets.GITHUB_TOKEN }} - firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_ATTAJAK }} - channelId: preview - projectId: attajak From ebfb6ba8e057518069e11ea48c59a23af28d1286 Mon Sep 17 00:00:00 2001 From: attajak Date: Mon, 2 Mar 2026 14:25:56 +0700 Subject: [PATCH 2/3] Fixed --- .github/workflows/deploy-live.yml | 2 +- .github/workflows/deploy-preview.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-live.yml b/.github/workflows/deploy-live.yml index c5dddcb..79f6d07 100644 --- a/.github/workflows/deploy-live.yml +++ b/.github/workflows/deploy-live.yml @@ -115,7 +115,7 @@ jobs: deploy_live: environment: name: production - run-on: ubuntu-latest + runs-on: ubuntu-latest needs: build steps: - name: Checkout diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index 2be2674..1740325 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -93,7 +93,7 @@ jobs: deploy_preview: environment: name: preview - run-on: ubuntu-latest + runs-on: ubuntu-latest needs: build steps: - name: Checkout From 72244d995937bd31505e43e90ce17eccf801a00a Mon Sep 17 00:00:00 2001 From: attajak Date: Mon, 2 Mar 2026 14:32:27 +0700 Subject: [PATCH 3/3] Fixed01 --- .github/workflows/deploy-live.yml | 11 +---------- .github/workflows/deploy-preview.yml | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/.github/workflows/deploy-live.yml b/.github/workflows/deploy-live.yml index 79f6d07..b5afc33 100644 --- a/.github/workflows/deploy-live.yml +++ b/.github/workflows/deploy-live.yml @@ -36,7 +36,7 @@ defaults: run: shell: bash jobs: - build: + build_and_deploy_live: runs-on: ubuntu-latest env: DART_SASS_VERSION: 1.97.3 @@ -111,15 +111,6 @@ jobs: with: path: ${{ runner.temp }}/hugo_cache key: ${{ steps.cache-restore.outputs.cache-primary-key }} - - deploy_live: - environment: - name: production - runs-on: ubuntu-latest - needs: build - steps: - - name: Checkout - uses: actions/checkout@v6 - name: Deploy To Live Channel id: live uses: FirebaseExtended/action-hosting-deploy@v0 diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index 1740325..eecdd9d 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -13,7 +13,7 @@ defaults: run: shell: bash jobs: - build: + build_and_deploy_preview: if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest env: @@ -89,15 +89,6 @@ jobs: with: path: ${{ runner.temp }}/hugo_cache key: ${{ steps.cache-restore.outputs.cache-primary-key }} - - deploy_preview: - environment: - name: preview - runs-on: ubuntu-latest - needs: build - steps: - - name: Checkout - uses: actions/checkout@v6 - name: Deploy To Preview Channel id: preview uses: FirebaseExtended/action-hosting-deploy@v0