Skip to content

Commit 8df1858

Browse files
Add build and publish yaml
1 parent 4f1a4d0 commit 8df1858

3 files changed

Lines changed: 1103 additions & 2 deletions

File tree

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Build and Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
- '*/*'
8+
9+
env:
10+
CI_TOOLS_VERSION: '^5.0.0'
11+
# NOTE: Um den Releasezyklus von Alpha nach Beta zu ändern, einfach die nachfolgend deklarierten Env Variablen switchen.
12+
CI_TOOLS_ALPHA_BRANCH: next
13+
CI_TOOLS_ALPHA_NPM_TAG: next
14+
# CI_TOOLS_BETA_BRANCH: next
15+
# CI_TOOLS_BETA_NPM_TAG: next
16+
BOX_RELEASE_TAG: 2025-1
17+
18+
jobs:
19+
test:
20+
name: 'Run Tests'
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
token: ${{ secrets.GH_TOKEN }}
27+
28+
- name: Use Node.js 22
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '22'
32+
registry-url: 'https://registry.npmjs.org'
33+
34+
- name: Install Dependencies
35+
run: npm ci
36+
37+
- name: Run tests
38+
run: npm test
39+
40+
build_and_publish:
41+
name: 'Build and publish sources'
42+
runs-on: ubuntu-latest
43+
needs: test
44+
if: "!(contains(github.actor, 'process-engine-ci') || contains(github.actor, 'admin'))"
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 0
50+
token: ${{ secrets.GH_TOKEN }}
51+
52+
- name: Use Node.js 22
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: '22'
56+
registry-url: 'https://registry.npmjs.org'
57+
58+
- name: Install CI Tools
59+
env:
60+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
61+
run: npm i -g @5minds/product_ci_tools@${{ env.CI_TOOLS_VERSION }}
62+
63+
- name: 'Install Dependencies'
64+
env:
65+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
66+
run: npm ci
67+
68+
- name: 'Prepare Version'
69+
if: "!startsWith(github.ref_name, 'renovate')"
70+
run: ci_tools prepare-version --allow-dirty-workdir
71+
72+
- name: 'Commit & Tag Version'
73+
if: "!startsWith(github.ref_name, 'renovate')"
74+
env:
75+
GH_USER: ${{ secrets.GH_USER }}
76+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
77+
run: |
78+
ci_tools commit-and-tag-version --only-on-primary-branches
79+
ci_tools update-github-release --only-on-primary-branches --use-title-and-text-from-git-tag
80+
81+
- name: 'Publish Version'
82+
if: "!startsWith(github.ref_name, 'renovate')"
83+
env:
84+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
85+
run: ci_tools publish-npm-package --create-tag-from-branch-name
86+
87+
- name: Add Box-Release Tag
88+
if: github.ref == 'refs/heads/main'
89+
env:
90+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
91+
run: |
92+
VERSION="$(ci_tools get-version)"
93+
PACKAGE_NAME="$(npm pkg get name | tr -d \")"
94+
npm dist-tag add $PACKAGE_NAME@$VERSION ${{ env.BOX_RELEASE_TAG }}

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
node_modules
2-
package-lock.json
1+
node_modules

0 commit comments

Comments
 (0)