|
7 | 7 | - "generator-widget-v*" |
8 | 8 |
|
9 | 9 | jobs: |
| 10 | + discover: |
| 11 | + name: Discover packages to publish |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + releases: ${{ steps.export.outputs.releases }} |
| 15 | + steps: |
| 16 | + - name: Checking-out code |
| 17 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 |
| 18 | + |
| 19 | + - name: Get tags for HEAD |
| 20 | + id: export |
| 21 | + run: | |
| 22 | + echo "releases=$( |
| 23 | + ( |
| 24 | + for tag in $(git tag --points-at HEAD); do |
| 25 | + echo "{ \"package\": \"${tag%-v*}\", \"version\": \"${tag##*-v}\" }" |
| 26 | + done |
| 27 | + ) | jq --slurp '.' |
| 28 | + )" >> "$GITHUB_OUTPUT" |
| 29 | +
|
10 | 30 | publish: |
11 | 31 | name: "Publish NPM packages" |
12 | 32 | runs-on: ubuntu-latest |
13 | 33 |
|
| 34 | + strategy: |
| 35 | + fail-fast: false |
| 36 | + matrix: |
| 37 | + release: ${{ fromJSON(needs.discover.outputs.releases) }} |
| 38 | + environment: ${{ matrix.release.package }} |
| 39 | + |
14 | 40 | steps: |
15 | | - - name: "Checking-out code" |
16 | | - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2 |
| 41 | + - name: Check-out code |
| 42 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 |
| 43 | + |
| 44 | + - name: Setup node |
| 45 | + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
17 | 46 | with: |
18 | | - submodules: false |
| 47 | + node-version-file: ".nvmrc" |
| 48 | + cache: 'pnpm' |
19 | 49 |
|
20 | 50 | - name: Setup pnpm |
21 | 51 | uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0 |
22 | 52 | with: |
23 | 53 | version: 10 |
24 | 54 |
|
25 | | - - name: "Defining Environment Variables" |
26 | | - id: variables |
27 | | - run: echo "::set-output name=tag::$(git tag --points-at HEAD)" |
28 | | - |
29 | | - - name: "Defining node version" |
30 | | - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
31 | | - with: |
32 | | - node-version-file: ".nvmrc" |
33 | | - cache: 'pnpm' |
34 | | - |
35 | | - - name: "Installing generator-widget dependencies" |
| 55 | + - name: Install dependencies |
| 56 | + working-directory: ./packages/${{ matrix.release.package }} |
36 | 57 | run: pnpm install |
37 | 58 |
|
38 | | - - name: "Targeting Pluggable Widgets Tools" |
39 | | - if: contains(steps.variables.outputs.tag, 'pluggable-widgets-tools-v') |
40 | | - uses: JS-DevTools/npm-publish@0f451a94170d1699fd50710966d48fb26194d939 # v1 |
41 | | - with: |
42 | | - package: "./packages/pluggable-widgets-tools/package.json" |
43 | | - token: ${{ secrets.NPM_TOKEN }} |
| 59 | + - name: Pack package |
| 60 | + working-directory: ./packages/${{ matrix.release.package }} |
| 61 | + run: pnpm pack |
44 | 62 |
|
45 | | - - name: "Targeting Pluggable Widgets Generator" |
46 | | - if: contains(steps.variables.outputs.tag, 'generator-widget-v') |
47 | | - uses: JS-DevTools/npm-publish@0f451a94170d1699fd50710966d48fb26194d939 # v1 |
| 63 | + - name: Setup node for npm publishing |
| 64 | + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
48 | 65 | with: |
49 | | - package: "./packages/generator-widget/package.json" |
50 | | - token: ${{ secrets.NPM_TOKEN }} |
| 66 | + node-version: '24' # Includes a version of npm higher than 11.5.1, which is needed for OIDC |
| 67 | + |
| 68 | + - name: Publish package |
| 69 | + working-directory: ./packages/${{ matrix.release.package }} |
| 70 | + run: npm publish mendix-${{ matrix.release.package }}-${{matrix.release.version }}.tgz |
0 commit comments