-
Notifications
You must be signed in to change notification settings - Fork 2
139 lines (122 loc) · 4.43 KB
/
__call-ci-node.yml
File metadata and controls
139 lines (122 loc) · 4.43 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
134
135
136
137
138
139
---
# This workflow is intended to work with all our organization Node projects.
# This workflow will run tests using node and then create a draft release on GitHub for push events to master.
name: CI-Node (called)
permissions: {}
on:
workflow_call:
secrets:
CODECOV_TOKEN:
description: 'Codecov token to use for the workflow.'
required: false
GH_TOKEN:
description: 'GitHub bot token to use for the workflow.'
required: false
jobs:
setup_release:
name: Setup Release
outputs:
publish_release: ${{ steps.setup_release.outputs.publish_release }}
release_body: ${{ steps.setup_release.outputs.release_body }}
release_generate_release_notes: ${{ steps.setup_release.outputs.release_generate_release_notes }}
release_tag: ${{ steps.setup_release.outputs.release_tag }}
release_version: ${{ steps.setup_release.outputs.release_version }}
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Release
id: setup_release
uses: LizardByte/actions/actions/release_setup@4125866b7b655a6fe038b0e22a43a4c5d259af79 # v2026.417.35446
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
build:
needs:
- setup_release
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: latest
- name: Set version
env:
RELEASE_VERSION: ${{ needs.setup_release.outputs.release_version }}
id: version
run: |
VERSION=${RELEASE_VERSION}
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
VERSION=$(date +%Y.%m%d.%H%M%S)
fi
echo "RELEASE_VERSION=${VERSION}" >> "${GITHUB_OUTPUT}"
- name: Update package.json
env:
RELEASE_VERSION: ${{ steps.version.outputs.RELEASE_VERSION }}
run: npm version "${RELEASE_VERSION}" --no-git-tag-version
- name: Install dependencies
run: npm install --ignore-scripts
- name: Test
id: test
env:
FORCE_COLOR: true
run: npm test
- name: Build
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: npm run build
- name: Publish (dry run)
run: npm publish --dry-run
- name: Upload test coverage
# any except canceled or skipped
if: >-
always() &&
(steps.test.outcome == 'success' || steps.test.outcome == 'failure') &&
startsWith(github.repository, 'LizardByte/')
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
disable_search: true
fail_ci_if_error: true
files: ./coverage/coverage-final.json
report_type: coverage
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Upload test results
# any except canceled or skipped
if: >-
always() &&
(steps.test.outcome == 'success' || steps.test.outcome == 'failure') &&
startsWith(github.repository, 'LizardByte/')
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
fail_ci_if_error: true
files: ./junit.xml,!./cache
report_type: test_results
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
release:
if: needs.setup_release.outputs.publish_release == 'true'
needs:
- setup_release
- build
permissions: {}
runs-on: ubuntu-latest
steps:
- name: Create Release
id: action
uses: LizardByte/actions/actions/release_create@4125866b7b655a6fe038b0e22a43a4c5d259af79 # v2026.417.35446
with:
allowUpdates: false
artifacts: ''
body: ${{ needs.setup_release.outputs.release_body }}
draft: true
generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }}
name: ${{ needs.setup_release.outputs.release_tag }}
prerelease: true
tag: ${{ needs.setup_release.outputs.release_tag }}
token: ${{ secrets.GH_TOKEN }}