diff options
Diffstat (limited to 'third_party/rust/jsparagus/.github/workflows/ci-generated.yml')
-rw-r--r-- | third_party/rust/jsparagus/.github/workflows/ci-generated.yml | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/third_party/rust/jsparagus/.github/workflows/ci-generated.yml b/third_party/rust/jsparagus/.github/workflows/ci-generated.yml new file mode 100644 index 0000000000..4027c6c9c6 --- /dev/null +++ b/third_party/rust/jsparagus/.github/workflows/ci-generated.yml @@ -0,0 +1,54 @@ +name: Generate Files + +on: + push: + branches: + - master + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # otherwise, you will failed to push refs to dest repo + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: "3.7" + - name: Setup Git Profile + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + - name: Revert Previous Change and Merge Master + run: | + if git ls-remote origin | grep refs/heads/ci_generated; then + # If the remote branch exists. + git fetch origin + + # Merge master, discarding changes in origin/ci_generated + MASTER_REV=$(git log -1 master --pretty=%H) + git checkout -b ci_generated-master origin/master + git merge origin/ci_generated -m "Merge master ${MASTER_REV}" -s ours --allow-unrelated-histories + else + # Otherwise, just start from master branch. + git checkout -b ci_generated-master + fi + - name: Generate Files + run: | + make init-venv && make all + # OS independant replace + sed -i.bak '/*_generated.rs/d' .gitignore && rm .gitignore.bak + - name: Commit files + run: | + git add . + MASTER_REV=$(git log -1 master --pretty=%H) + git commit -m "Add Generated Files for ${MASTER_REV}" -a + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ci_generated + |