Skip to content

Commit d04d469

Browse files
committed
Switch NPM package workflow to use conan-version trigger
This update modifies the NPM package workflow to initiate upon completion of the conan-package workflow, enhancing integration between the workflows. The setup and dependency installation have been streamlined by using a shared build environment action. These changes aim to simplify the build process and reduce dependency management overhead. Contribute to NP-637
1 parent 67bb4fc commit d04d469

File tree

1 file changed

+22
-74
lines changed

1 file changed

+22
-74
lines changed

.github/workflows/npm-package.yml

Lines changed: 22 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,46 @@
11
name: NPM package
22

33
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
108

119
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
1415

16+
publish-npm:
17+
runs-on: ubuntu-latest
18+
needs: [ conan-recipe-version ]
1519
permissions:
1620
contents: read
1721
packages: write
1822

1923
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
2226
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
2832

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 .
7935

8036
- name: Use Node.js
8137
uses: actions/setup-node@v4
8238
with:
8339
registry-url: 'https://npm.pkg.github.com'
8440
scope: '@ultimaker'
8541

86-
- name: Set npm config
42+
- name: Publish to GitHub Packages
8743
run: |
88-
cd CuraEngineJS
8944
npm publish
9045
env:
9146
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

Comments
 (0)