forked from amplication/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (55 loc) · 1.84 KB
/
nx.template.yaml
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
name: _Reusable nx template
on:
workflow_call:
inputs:
nx-head:
type: string
description: Commit SHA, branch or tag name used by Nx in the affected jobs as head.
required: true
nx-base:
type: string
description: Commit SHA, branch or tag name used by Nx in the affected jobs as base.
required: true
outputs:
affected-plugins:
description: Nx plugins affected by the changes
value: ${{ jobs.nx.outputs.affected-plugins }}
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_BRANCH: ${{ github.event.workflow_run.head_branch }}
BRANCH: ${{ github.event.workflow_run.head_branch }}
jobs:
nx:
name: Nx Affected Publishable Plugins
runs-on: ubuntu-20.04
outputs:
affected-plugins: ${{ steps.calculate-affected.outputs.affected-plugins }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.nx-head }}
filter: blob:none
- name: Nx set sha
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: ${{ inputs.nx-base }}
- name: Setup Bun Runtime
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: oven-sh/setup-bun@v1
- name: Cache
id: cache
uses: actions/cache@v3
env:
cache-name: cache
with:
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
path: |
~/.bun/install/cache
- name: Install Dependencies
run: bun i --lockfile package-lock.json
- name: Evaluate affected projects
id: calculate-affected
run: |
echo affected-plugins=$(bunx nx show projects --affected --with-target npm:publish --json) >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT | grep affected