|
| 1 | +name: Build AR.js libraries |
| 2 | + |
| 3 | +# Controls when the action will run. Triggers the workflow on push or pull request |
| 4 | +# events but only for the master branch. |
| 5 | +# The action script will build all the libs and will commit the files. When a new git tag is created |
| 6 | +# will be made a new release. |
| 7 | +on: push |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + node-version: [14.x] |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v2 |
| 18 | + - name: Use Node.js ${{ matrix.node-version }} |
| 19 | + uses: actions/setup-node@v1 |
| 20 | + with: |
| 21 | + node-version: ${{ matrix.node-version }} |
| 22 | + - uses: actions/cache@v2 |
| 23 | + with: |
| 24 | + path: ~/.npm |
| 25 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 26 | + restore-keys: | |
| 27 | + ${{ runner.os }}-node- |
| 28 | + - name: Set output |
| 29 | + id: vars |
| 30 | + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} |
| 31 | + - name: Check output |
| 32 | + env: |
| 33 | + RELEASE_VERSION: ${{ steps.vars.outputs.tag }} |
| 34 | + run: | |
| 35 | + echo $RELEASE_VERSION |
| 36 | + echo ${{ steps.vars.outputs.tag }} |
| 37 | + - run: npm update |
| 38 | + - run: npm install |
| 39 | + - uses: actions/upload-artifact@v2 |
| 40 | + with: |
| 41 | + name: build |
| 42 | + path: | |
| 43 | + aframe/build/*.js |
| 44 | + three.js/build/*.js |
| 45 | + - run: | |
| 46 | + npm run build |
| 47 | + - name: Commit changes |
| 48 | + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} |
| 49 | + uses: EndBug/add-and-commit@v9 |
| 50 | + with: |
| 51 | + default_author: github_actions |
| 52 | + message: new build files from action |
| 53 | + add: '["aframe/build", "three.js/build"]' |
| 54 | + - name: Release |
| 55 | + uses: softprops/action-gh-release@v1 |
| 56 | + if: startsWith(github.ref, 'refs/tags/') |
| 57 | + with: |
| 58 | + files: | |
| 59 | + aframe/build/aframe-ar.js |
| 60 | + aframe/build/aframe-ar-nft.js |
| 61 | + aframe/build/aframe-ar-location-only.js |
| 62 | + three.js/build/ar.js |
| 63 | + three.js/build/ar-threex.js |
| 64 | + three.js/build/ar-threex-location-only.js |
0 commit comments