[UPSTREAM] Ports Genpop from NSV to BeeStation to NSV (#2620) #56
This file contains 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: Rebuild TGUI | |
on: | |
repository_dispatch: | |
types: [rebuild-tgui] | |
push: | |
branches: | |
- 'master' | |
paths: | |
- 'tgui/**.js' | |
- 'tgui/**.scss' | |
# Config | |
env: | |
COMMIT_NAME: 'ss13-beebot' | |
COMMIT_EMAIL: '[email protected]' | |
DEFAULT_BRANCH: 'master' | |
TOKEN: '${{ secrets.CL_TOKEN }}' | |
jobs: | |
ondemand_rebuild: | |
if: ${{ github.event_name == 'repository_dispatch' }} | |
name: On-Demand Rebuild | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
repository: ${{ github.event.client_payload.pr_head_full_repo_name }} | |
ref: ${{ github.event.client_payload.pr_head_ref }} | |
token: ${{ env.TOKEN }} | |
- name: Setup Author | |
run: | | |
git config --local user.email "${{ env.COMMIT_EMAIL }}" | |
git config --local user.name "${{ env.COMMIT_NAME }}" | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '>=12.13' | |
# This only runs if the PR has a merge conflict. Serves to attempt resolving merge conflicts rather than just rebuilding. | |
# Uses a smart little git hack to make a merge commit for just a limited set of files. | |
- name: Conflict Resolution | |
if: ${{ github.event.client_payload.mergeable == false }} | |
run: | | |
git remote add base https://github.com/${{ github.repository }}.git | |
git fetch base ${{ env.DEFAULT_BRANCH }} | |
git merge --squash -s ours --no-commit base/${{ env.DEFAULT_BRANCH }} | |
git checkout HEAD . | |
git clean -fxd | |
git checkout base/${{ env.DEFAULT_BRANCH }} tgui/public | |
git commit -m "TGUI Reset" -a || true | |
- name: Build TGUI | |
run: bin/tgui | |
working-directory: ./tgui | |
- name: Commit and Push Build | |
run: | | |
git commit -m "TGUI Rebuild" -a || true | |
git push | |
auto_rebuild: | |
if: ${{ github.event_name == 'push' }} | |
name: Automatic Rebuild | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 25 | |
token: ${{ env.TOKEN }} | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '>=12.13' | |
- name: Build TGUI | |
run: bin/tgui | |
working-directory: ./tgui | |
- name: Commit and Push Build | |
run: | | |
git config --local user.email "${{ env.COMMIT_EMAIL }}" | |
git config --local user.name "${{ env.COMMIT_NAME }}" | |
git pull origin master | |
git commit -m "Automatic TGUI Rebuild [ci skip]" -a || true | |
git push |