update effekt compiler #90
Workflow file for this run
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 effekt compiler | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| effekt_commit: | |
| description: "Commit SHA of Effekt submodule to checkout and build. If omitted, the latest commit is chosen. (OPTIONAL)" | |
| required: false | |
| schedule: | |
| - cron: '0 10 * * 1' # 10:00, every monday | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup Scala & sbt | |
| uses: olafurpg/setup-scala@v11 | |
| with: | |
| java-version: openjdk@1.17 | |
| - name: Setup nodejs | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| # Login as a GitHub App in order to bypass GitHub's rules about automatic releases | |
| - name: Get GitHub App token | |
| uses: actions/create-github-app-token@v2 | |
| id: app-token | |
| with: | |
| app-id: ${{ secrets.EFFEKT_UPDATER_GH_APP_ID }} | |
| private-key: ${{ secrets.EFFEKT_UPDATER_GH_CREDENTIALS_TOKEN }} | |
| - name: Checkout repository with token | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| token: ${{ steps.app-token.outputs.token }} | |
| fetch-depth: 2 | |
| fetch-tags: true | |
| ref: master | |
| - name: Checkout given commit | |
| if: "${{ github.event.inputs.effekt_commit != '' }}" | |
| run: | | |
| cd effekt/ | |
| git checkout --recurse-submodules ${{ github.event.inputs.effekt_commit }} | |
| # get the latest tag and check out the corresponding commit | |
| - name: Checkout latest tag | |
| if: "${{ github.event.inputs.effekt_commit == '' }}" | |
| run: | | |
| cd effekt/ | |
| git checkout --recurse-submodules $(git describe --tags $(git rev-list --tags --max-count=1)) | |
| - name: Compile Effekt to JS | |
| run: | | |
| cd effekt/ | |
| sbt assembleJS | |
| cp -f out/effekt.js ../src/effekt.js | |
| - name: Run webpack | |
| run: | | |
| npm install | |
| rm -f dist/* | |
| npx webpack | |
| - name: Commit and Push Changes | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: | | |
| git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' | |
| git config --global user.email '${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com' | |
| git add src/ dist/ effekt/ | |
| git commit -m "Github Action: update compiler $(git -C effekt show -s --format=%h)" || echo "nothing to commit" | |
| git push origin master |