File: emscripten.yml

package info (click to toggle)
liblouis 3.36.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 86,248 kB
  • sloc: ansic: 37,162; makefile: 1,298; python: 772; lisp: 390; sh: 339; perl: 221; cpp: 21
file content (98 lines) | stat: -rw-r--r-- 4,123 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Emscripten

on:
  workflow_dispatch:
  push:
    branches: [ master ]

jobs:
  js-build:
    name: Build liblouis for js

    runs-on: ubuntu-latest

    steps:
    - name: Harden Runner
      uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
      with:
        egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs

    - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

    # Contains tests and js snippets appended to builds. The tests are
    # not run for now. liblouis-js version should be incremented by
    # hand, to keep the repositories in sync.
    - name: Obtain liblouis-js
      run: git clone https://github.com/liblouis/liblouis-js.git

    - name: Pull the docker image
      run: docker pull dolp/liblouis-js-build-travis:1.37.3-64bit

    - name: Run the docker image
      run: docker run --rm -v $(pwd):/src dolp/liblouis-js-build-travis:1.37.3-64bit /bin/bash  ".github/workflows/scripts/emscripten-build.sh"

#    - name: Move the build result to a better place
#      run: |
#        cp -r ./out/* ./liblouis-js/js-build
#        cp -r ./out-emscripten-install/share/liblouis/tables ./liblouis-js/js-build/
#
#    - name: Echo phantomjs version
#      run: phantomjs --version
#
#    # `npm link` exposes the newly build npm package to the test
#    # runner. The `--production`-flag is necessary as it ensures that
#    # no publicly published package of the build is downloaded and
#    # tested instead.
#    - name: Build and test the npm package
#      run: |
#        cd ./liblouis-js
#        # FIXME: unclear why the npm link is needed
#        sudo npm link js-build --production
#        npm test
#        cd ..

    - name: Upload the release assets
      uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
      with:
        name: build-no-tables-utf32.js
        path: ./out/build-no-tables-utf32.js

    - name: Upload the assets to the snapshot release
      # only upload to snapshot page if it is a push to master in the main repo
      if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository =='liblouis/liblouis'}}
      uses: shogo82148/actions-upload-release-asset@59cbc563d11314e48122193f8fe5cdda62ea6cf9 # v1.9.1
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        upload_url: https://uploads.github.com/repos/liblouis/liblouis/releases/8031256/assets{?name,label}
        asset_path: ./out/build-no-tables-utf32.js
        asset_name: build-no-tables-utf32.js
        asset_content_type: application/javascript
        overwrite: true

    - name: Publish JS file and tables to js-build
      # only publish if it is a push to master in the main repo
      if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository =='liblouis/liblouis'}}
      env:
        GITHUB_TOKEN: ${{ secrets.JS_BUILD_GITHUB_TOKEN }}
      run: |
        # clone the repository to a location outside of the liblouis
        # repository to avoid issues caused by nested repositories
        git clone --depth 1 https://github.com/liblouis/js-build.git ../js-build
        rm -f ../js-build/build-*.js
        rm -rf ../js-build/tables/
        cp -R ./out-emscripten-install/share/liblouis/tables/ ../js-build/tables/
        cp -Rf ./out/* ../js-build/
        cd ../js-build
        git add --all
        git remote set-url origin https://${GITHUB_TOKEN}@github.com/liblouis/js-build.git
        git config user.name "Github CI"
        git config user.email "liblouis@users.noreply.github.com"
        BUILD_VERSION=commit-$(echo $GITHUB_SHA | cut -c1-6)
        if [[ -z $(git diff --cached --exit-code) ]]; then
            : Build is identical to previous build. Omitting commit, only adding tag.
        else
            git commit -m "Automatic build of version ${BUILD_VERSION}"
            git push origin master:master
        fi
        git tag -a ${BUILD_VERSION} -m "automatic build for version ${BUILD_VERSION}"
        git push origin $BUILD_VERSION:$BUILD_VERSION