Debian Codegraph @

.github/workflows/emscripten.yml

raw symbols SCIP
1 name: Emscripten
2
3 on:
4 workflow_dispatch:
5 push:
6 branches: [ master ]
7
8 jobs:
9 js-build:
10 name: Build liblouis for js
11
12 runs-on: ubuntu-latest
13
14 steps:
15 - name: Harden Runner
16 uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
17 with:
18 egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
19
20 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
21
22 # Contains tests and js snippets appended to builds. The tests are
23 # not run for now. liblouis-js version should be incremented by
24 # hand, to keep the repositories in sync.
25 - name: Obtain liblouis-js
26 run: git clone https://github.com/liblouis/liblouis-js.git
27
28 - name: Pull the docker image
29 run: docker pull dolp/liblouis-js-build-travis:1.37.3-64bit
30
31 - name: Run the docker image
32 run: docker run --rm -v $(pwd):/src dolp/liblouis-js-build-travis:1.37.3-64bit /bin/bash ".github/workflows/scripts/emscripten-build.sh"
33
34 # - name: Move the build result to a better place
35 # run: |
36 # cp -r ./out/* ./liblouis-js/js-build
37 # cp -r ./out-emscripten-install/share/liblouis/tables ./liblouis-js/js-build/
38 #
39 # - name: Echo phantomjs version
40 # run: phantomjs --version
41 #
42 # # `npm link` exposes the newly build npm package to the test
43 # # runner. The `--production`-flag is necessary as it ensures that
44 # # no publicly published package of the build is downloaded and
45 # # tested instead.
46 # - name: Build and test the npm package
47 # run: |
48 # cd ./liblouis-js
49 # # FIXME: unclear why the npm link is needed
50 # sudo npm link js-build --production
51 # npm test
52 # cd ..
53
54 - name: Upload the release assets
55 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
56 with:
57 name: build-no-tables-utf32.js
58 path: ./out/build-no-tables-utf32.js
59
60 - name: Upload the assets to the snapshot release
61 # only upload to snapshot page if it is a push to master in the main repo
62 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository =='liblouis/liblouis'}}
63 uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2
64 with:
65 github_token: ${{ secrets.GITHUB_TOKEN }}
66 upload_url: https://uploads.github.com/repos/liblouis/liblouis/releases/8031256/assets{?name,label}
67 asset_path: ./out/build-no-tables-utf32.js
68 asset_name: build-no-tables-utf32.js
69 asset_content_type: application/javascript
70 overwrite: true
71
72 - name: Publish JS file and tables to js-build
73 # only publish if it is a push to master in the main repo
74 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository =='liblouis/liblouis'}}
75 env:
76 GITHUB_TOKEN: ${{ secrets.JS_BUILD_GITHUB_TOKEN }}
77 run: |
78 # clone the repository to a location outside of the liblouis
79 # repository to avoid issues caused by nested repositories
80 git clone --depth 1 https://github.com/liblouis/js-build.git ../js-build
81 rm -f ../js-build/build-*.js
82 rm -rf ../js-build/tables/
83 cp -R ./out-emscripten-install/share/liblouis/tables/ ../js-build/tables/
84 cp -Rf ./out/* ../js-build/
85 cd ../js-build
86 git add --all
87 git remote set-url origin https://${GITHUB_TOKEN}@github.com/liblouis/js-build.git
88 git config user.name "Github CI"
89 git config user.email "[email protected]"
90 BUILD_VERSION=commit-$(echo $GITHUB_SHA | cut -c1-6)
91 if [[ -z $(git diff --cached --exit-code) ]]; then
92 : Build is identical to previous build. Omitting commit, only adding tag.
93 else
94 git commit -m "Automatic build of version ${BUILD_VERSION}"
95 git push origin master:master
96 fi
97 git tag -a ${BUILD_VERSION} -m "automatic build for version ${BUILD_VERSION}"
98 git push origin $BUILD_VERSION:$BUILD_VERSION