|
1 | 1 | name: NPM package |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_dispatch: |
5 | | - inputs: |
6 | | - branch: |
7 | | - description: 'Branch to build' |
8 | | - required: true |
9 | | - default: 'main' |
| 4 | + workflow_run: |
| 5 | + workflows: ["conan-package"] |
| 6 | + types: |
| 7 | + - completed |
10 | 8 |
|
11 | 9 | jobs: |
12 | | - build: |
13 | | - runs-on: ubuntu-latest |
| 10 | + conan-recipe-version: |
| 11 | + name: Calculate version numbers |
| 12 | + uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml |
| 13 | + permissions: |
| 14 | + contents: read |
14 | 15 |
|
| 16 | + publish-npm: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + needs: [ conan-recipe-version ] |
15 | 19 | permissions: |
16 | 20 | contents: read |
17 | 21 | packages: write |
18 | 22 |
|
19 | 23 | steps: |
20 | | - - name: Checkout code |
21 | | - uses: actions/checkout@v4 |
| 24 | + - name: Setup the build environment |
| 25 | + uses: ultimaker/cura-workflows/.github/actions/setup-build-environment@NP-637_conan_v2_wasm # Remove this line after merge |
22 | 26 | with: |
23 | | - ref: ${{ github.event.inputs.branch }} |
24 | | - |
25 | | - - name: Sync pip requirements |
26 | | - run: curl -O https://raw.githubusercontent.com/Ultimaker/cura-workflows/main/.github/workflows/requirements-runner.txt |
27 | | - working-directory: .github/workflows |
| 27 | + conan_user: ${{ secrets.CONAN_USER }} |
| 28 | + conan_password: ${{ secrets.CONAN_PASS }} |
| 29 | + conan_config_branch: "NP-637_conan_v2_wasm" # Remove this line after merging https://github.com/Ultimaker/cura-workflows/pull/32 |
| 30 | + install_system_dependencies: true |
| 31 | + repository_path: _sources |
28 | 32 |
|
29 | | - - name: Setup Python and pip |
30 | | - uses: actions/setup-python@v4 |
31 | | - with: |
32 | | - python-version: 3.11.x |
33 | | - cache: pip |
34 | | - cache-dependency-path: .github/workflows/requirements-runner.txt |
35 | | - |
36 | | - - name: Install Python requirements and Create default Conan profile |
37 | | - run: pip install -r .github/workflows/requirements-runner.txt |
38 | | - |
39 | | - - name: Install Linux system requirements for building |
40 | | - run: | |
41 | | - mkdir runner_scripts |
42 | | - cd runner_scripts |
43 | | - curl -O https://raw.githubusercontent.com/Ultimaker/cura-workflows/main/runner_scripts/ubuntu_setup.sh |
44 | | - chmod +x ubuntu_setup.sh |
45 | | - sudo ./ubuntu_setup.sh |
46 | | -
|
47 | | - - name: Setup pipeline caches |
48 | | - run: | |
49 | | - mkdir -p /home/runner/.conan/downloads |
50 | | - mkdir -p /home/runner/.conan/data |
51 | | -
|
52 | | - - name: Create default Conan profile |
53 | | - run: conan profile new default --detect |
54 | | - |
55 | | - # FIXME: Once merged to main: conan config install https://github.com/Ultimaker/conan-config.git -a "-b runner/${{ runner.os }}/${{ runner.arch }}" |
56 | | - - name: Get Conan configuration |
57 | | - run: | |
58 | | - conan config install https://github.com/Ultimaker/conan-config.git |
59 | | - conan config install https://github.com/Ultimaker/conan-config.git -a "-b NP-419" |
60 | | -
|
61 | | - - name: Add runner credentials to cura remote |
62 | | - run: conan user -p ${{ secrets.CONAN_PASS }} -r cura ${{ secrets.CONAN_USER }} |
63 | | - |
64 | | - - name: Cache Conan packages |
65 | | - uses: actions/cache@v3 |
66 | | - with: |
67 | | - path: /home/runner/.conan/data |
68 | | - key: ${{ runner.os }}-conan-data-${{ github.run_id }} |
69 | | - restore-keys: | |
70 | | - ${{ runner.os }}-conan-data- |
71 | | -
|
72 | | - - name: Cache Conan downloads |
73 | | - uses: actions/cache@v3 |
74 | | - with: |
75 | | - path: /home/runner/.conan/downloads |
76 | | - key: ${{ runner.os }}-conan-downloads-${{ github.run_id }} |
77 | | - restore-keys: | |
78 | | - ${{ runner.os }}-conan-downloads- |
| 33 | + - name: Gather/build the packages |
| 34 | + run: conan install --requires "${{ needs.conan-recipe-version.outputs.version_full }}" -pr:h cura_wasm.jinja --build=missing --update -of . |
79 | 35 |
|
80 | 36 | - name: Use Node.js |
81 | 37 | uses: actions/setup-node@v4 |
82 | 38 | with: |
83 | 39 | registry-url: 'https://npm.pkg.github.com' |
84 | 40 | scope: '@ultimaker' |
85 | 41 |
|
86 | | - - name: Set npm config |
| 42 | + - name: Publish to GitHub Packages |
87 | 43 | run: | |
88 | | - cd CuraEngineJS |
89 | 44 | npm publish |
90 | 45 | env: |
91 | 46 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
92 | | - |
93 | | - - name: Upload the Package(s) |
94 | | - if: ${{ always() }} |
95 | | - run: | |
96 | | - conan remove "cura_private_data/*" --force |
97 | | - conan remove "fdm_materials/*" --force |
98 | | - conan upload "*" -r cura --all -c |
0 commit comments