Merge pull request #134 from MekDrop/ci/autobuild-7 #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update dist folder | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: 'autobuild' | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update-dist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run format | |
| run: npm run format | |
| - name: Run pack | |
| run: npm run pack | |
| - name: Set current date as integer | |
| id: date | |
| run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | |
| - name: Set Branch Name | |
| id: set-branch | |
| run: echo "branch_name=autobuild-${{ steps.date.outputs.date }}" >> $GITHUB_OUTPUT | |
| - name: Create Pull Request | |
| id: create_pr | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ steps.set-branch.outputs.branch_name }} | |
| title: "[AUTOBUILD] ${{ steps.date.outputs.date }}" | |
| body: "Auto-generated update to dist/ from latest main push" | |
| base: main | |
| commit-message: "autobuild" | |
| author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> | |
| delete-branch: true | |
| signoff: false | |
| maintainer-can-modify: false | |
| - name: Sleep for 30 seconds | |
| if: ${{ steps.create_pr.outputs.pull-request-number }} | |
| uses: juliangruber/sleep-action@v2.0.0 | |
| with: | |
| time: 30s | |
| - name: Wait for all checks to complete | |
| if: ${{ steps.create_pr.outputs.pull-request-number }} | |
| id: wait-for-checks | |
| uses: lewagon/wait-on-check-action@v1.3.4 | |
| with: | |
| ref: ${{ steps.create_pr.outputs.pull-request-head-sha }} | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| wait-interval: 20 | |
| allowed-conclusions: success,skipped | |
| - name: Auto-merge PR if checks pass | |
| if: ${{ steps.create_pr.outputs.pull-request-number && success() }} | |
| run: | | |
| gh pr merge ${{ steps.create_pr.outputs.pull-request-number }} --merge --auto | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |