name: Release on: push: branches: - master jobs: build: runs-on: ubuntu-latest steps: - name: Set up Repository uses: actions/checkout@v2 with: ref: master - name: Set up Node uses: actions/setup-node@v2 with: node-version: 18 - name: Cache NPM Dependencies id: cache-npm-dependencies uses: actions/cache@v2 with: path: node_modules key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node_modules- - name: Install NPM Dependencies if not cached if: steps.cache-npm-dependencies.outputs.cache-hit != 'true' run: | npm install - name: Build Project run: | npm run build-prod - name: Upload Artifacts uses: actions/upload-artifact@v2 with: name: dist path: dist commit-build: needs: build runs-on: ubuntu-latest steps: - name: Set up Repository uses: actions/checkout@v2 with: ref: build - name: Download Build uses: actions/download-artifact@v2 with: name: dist path: dist - name: Commit and Push run: | if [ $(git status dist --porcelain=v1 2>/dev/null | wc -l) != "0" ] ; then git config user.name "GitHub Actions" git config user.email noreply@github.com git add dist git commit -m "chore: updated build" git push origin HEAD --force fi