-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
133 lines (126 loc) · 3.95 KB
/
action.yml
File metadata and controls
133 lines (126 loc) · 3.95 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: 'Initialize Bit'
description: 'Initialize Bit'
branding:
icon: 'download'
color: 'purple'
inputs:
ws-dir:
description: "Workspace json file directory path"
required: false
default: './'
skip-deps-install:
description: "Skip running 'bit install' command"
required: false
default: 'false'
skip-bit-install:
description: "Skip installing bit cli"
required: false
default: 'false'
cache:
description: "Enable caching"
required: false
default: 'false'
ripple:
description: "Use Ripple CI to build components"
required: false
default: 'false'
log:
description: "Log options for bit commands. Options: [trace, debug, info, warn, error, fatal]"
required: false
default: ''
upload-bit-log:
description: "Upload Bit debug log as a GitHub Actions artifact"
required: false
default: 'false'
# Deprecated inputs
docker:
description: "(Deprecated) Use Docker Container to build components"
required: false
default: 'false'
skip-install:
description: "(Deprecated) Skip running 'bit install' command"
required: false
default: 'false'
outputs:
engine:
value: ${{ steps.bit-init.outputs.engine }}
description: 'The Bit engine version defined in workspace.jsonc'
bit:
value: ${{ steps.bit-init.outputs.bit }}
description: 'The Bit version installed or available to execute the task'
org:
value: ${{ steps.bit-init.outputs.org }}
description: 'Bit organization defined in workspace.jsonc'
scope:
value: ${{ steps.bit-init.outputs.scope }}
description: 'Bit scope defined in workspace.jsonc'
runs:
using: 'composite'
steps:
- name: Detect if running in a container and create symlink if needed
shell: bash
run: |
if [ -f /.dockerenv ]; then
echo "Running inside a container."
echo "IS_CONTAINER=true" >> $GITHUB_ENV
echo "Creating symlink for Docker image..."
mkdir -p /home/runner
ln -sfn /__w /home/runner/work
else
echo "Not running inside a container."
echo "IS_CONTAINER=false" >> $GITHUB_ENV
fi
- name: Setup Node
if: env.IS_CONTAINER == 'false'
uses: actions/setup-node@v4
with:
node-version: '22.14'
- name: Install pnpm
if: inputs.cache == 'true'
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
- name: Get pnpm store directory
if: inputs.cache == 'true'
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent | tail -n 1)" >> $GITHUB_ENV
- name: Setup pnpm cache
if: inputs.cache == 'true'
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Run Bit Initialization Script
id: bit-init
run: node ${{ github.action_path }}/dist/index.js
shell: bash
env:
WSDIR: ${{ inputs.ws-dir }}
CACHE: ${{ inputs.cache }}
RIPPLE: ${{ inputs.ripple }}
LOG: ${{ inputs.log }}
SKIP_BIT_INSTALL: ${{ inputs.skip-bit-install }}
SKIP_DEPS_INSTALL: ${{ inputs.skip-deps-install == 'true' && inputs.skip-deps-install || inputs.skip-install }}
- name: Propagate upload-bit-log setting
if: inputs.upload-bit-log == 'true'
shell: bash
run: echo "UPLOAD_BIT_LOG=true" >> $GITHUB_ENV
- name: Get Bit log path
if: inputs.upload-bit-log == 'true'
id: bit-log
shell: bash
run: |
LOG_PATH=$(bit globals --json | jq -r '."Log file"')
echo "path=$LOG_PATH" >> $GITHUB_OUTPUT
- name: Upload Bit Log
if: inputs.upload-bit-log == 'true'
uses: actions/upload-artifact@v4
with:
name: bit-debug-log-init
path: ${{ steps.bit-log.outputs.path }}
if-no-files-found: ignore
retention-days: 5