Add GItHub workflows for automatic compilation and build push #1
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: "Autobuild Javascript module" | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build_js: | |
name: "Build main Javascript module" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout to workspace | |
uses: actions/checkout@v4 | |
- name: Print all environment variables | |
run: printenv | |
- name: Install esbuild | |
run: | | |
npm install esbuild | |
- name: Build main Javascript module | |
run: | | |
npx esbuild src/main.ts --outfile=js/main.js --bundle | |
- name: Commit changed files | |
if: always() | |
run: | | |
git config --global user.name "Github Action" | |
git config --global user.email "action@github.com" | |
git add js/main.js && \ | |
(git commit -m "[Github Action] Update js/main.js" || true) && \ | |
git checkout . && \ | |
git pull origin ${GITHUB_REF##*/} --rebase --strategy-option=ours | |
- name: Push changes | |
uses: ad-m/github-push-action@v0.8.0 | |
with: | |
branch: ${{ github.ref }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} |