From a6c3c0c6cb4062cc2b67639bf13ff08702201193 Mon Sep 17 00:00:00 2001 From: Diego Marcos Segura Date: Wed, 25 Jun 2025 19:08:25 -0700 Subject: [PATCH] Fix build workflow --- .github/workflows/build-dist.yml | 39 ++++++++++++++------------------ 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build-dist.yml b/.github/workflows/build-dist.yml index 36ab2c4..ace6787 100644 --- a/.github/workflows/build-dist.yml +++ b/.github/workflows/build-dist.yml @@ -1,17 +1,19 @@ -name: Build dist - -on: - push: - branches: - - main - jobs: build-dist: runs-on: ubuntu-latest steps: + - name: Generate GitHub App token + id: generate-token + uses: tibdex/github-app-token@v2 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Checkout repository uses: actions/checkout@v4 + with: + token: ${{ steps.generate-token.outputs.token }} - name: Set up Node.js uses: actions/setup-node@v4 @@ -24,27 +26,20 @@ jobs: - name: Build Dist run: npm run build - - name: Generate GitHub App token - id: generate-token - uses: tibdex/github-app-token@v2 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} - - name: Commit and push changes env: TOKEN: ${{ steps.generate-token.outputs.token }} run: | - - git config user.name "spark-website-deploy[bot]" git config user.email "123456789+spark-website-deploy[bot]@users.noreply.github.com" + git add . git commit -m "Bump dist build" || echo "No build changes" - git rev-parse HEAD > dist/commit.txt - SHA=$(git rev-parse HEAD) - git add dist/commit.txt - git commit -m "Update main CDN URL. (https://cdn.jsdelivr.net/gh/sparkjsdev/spark@$SHA/dist/spark.module.js)" - git remote set-url origin "https://x-access-token:${TOKEN}@github.com/${{ github.repository }}" - git push origin HEAD:main + SHA=$(git rev-parse HEAD) + echo "$SHA" > dist/commit.txt + + git add dist/commit.txt + git commit -m "Update main CDN URL. (https://cdn.jsdelivr.net/gh/sparkjsdev/spark@$SHA/dist/spark.module.js)" || echo "No SHA change" + + git push origin HEAD:main