From 85f6082f64f51eb8050032fc88218f8a7cf51e37 Mon Sep 17 00:00:00 2001 From: Vitaliy Stoliarov Date: Thu, 4 Jan 2024 22:52:21 +0200 Subject: [PATCH] Create build-push.yml --- .github/workflows/build-push.yml | 61 ++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/build-push.yml diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml new file mode 100644 index 0000000..0ca8276 --- /dev/null +++ b/.github/workflows/build-push.yml @@ -0,0 +1,61 @@ +name: Build and Push +run-name: Build and Push to dist/${{ github.ref_name }} + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Node.js + uses: actions/setup-node@v4 + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - uses: actions/upload-artifact@v3 + with: + name: tmp + path: dist + push: + needs: [build] + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Prepare + run: | + git checkout --orphan dist/${{ github.ref_name }} + git config --local user.email rete-js[bot]@users.noreply.github.com + git config --local user.name rete-js[bot] + git rm -rf . + + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: tmp + path: . + + - name: Commit changes + run: | + git add . + git commit -m "dist" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: dist/${{ github.ref_name }}