From 8b785993e3d0a557c6d58e7c889016720edfea45 Mon Sep 17 00:00:00 2001 From: Adam Graham Date: Tue, 19 Nov 2024 02:47:52 -0600 Subject: [PATCH] Update github workflow to push dist to repo --- .../{cdn-deploy.yml => build-push-deploy.yml} | 36 ++++++++++++++++--- README.md | 2 +- 2 files changed, 32 insertions(+), 6 deletions(-) rename .github/workflows/{cdn-deploy.yml => build-push-deploy.yml} (60%) diff --git a/.github/workflows/cdn-deploy.yml b/.github/workflows/build-push-deploy.yml similarity index 60% rename from .github/workflows/cdn-deploy.yml rename to .github/workflows/build-push-deploy.yml index f8b4eb6..bb27f86 100644 --- a/.github/workflows/cdn-deploy.yml +++ b/.github/workflows/build-push-deploy.yml @@ -1,4 +1,4 @@ -name: Deploy to CDN +name: Build Push Deploy on: push: @@ -19,11 +19,10 @@ jobs: node-version: 20 cache: yarn - - name: Increase network timeout - run: yarn config set network-timeout 300000 - - name: Install dependencies - run: yarn install --prefer-offline + run: | + yarn config set network-timeout 300000 + yarn install --prefer-offline - name: Build continue-on-error: false @@ -36,6 +35,33 @@ jobs: path: dist retention-days: 30 + push: + name: Push + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: dist + path: dist + + - name: Push distribution + run: | + MSG="$(printf "Publish distribution\n[skip ci]")" + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add dist/index.min.* -f + git commit -m "$MSG" --no-verify --signoff + git push origin $BRANCH_NAME + deploy: name: Deploy needs: build diff --git a/README.md b/README.md index 5e311da..b603194 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Forge React -GitHub Actions Workflow Status +GitHub Actions Workflow Status GitHub package.json version GitHub License