Skip to content

Commit 99a6175

Browse files
authored
CI: build artifacts on tag/release event (OpenEMS#2332)
* create seprate release action * change to push event
1 parent 52d38cc commit 99a6175

File tree

2 files changed

+97
-57
lines changed

2 files changed

+97
-57
lines changed

.github/workflows/build.yml

+1-57
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,6 @@ jobs:
6666
name: jacoco_report
6767
path: jacoco/
6868

69-
#
70-
# Is this a Tag? Prepare release assets
71-
#
72-
- name: Prepare Edge+Backend assets
73-
if: startsWith(github.ref, 'refs/tags/')
74-
run: ./gradlew buildEdge buildBackend
75-
76-
- name: Save build-artifacts
77-
if: startsWith(github.ref, 'refs/tags/')
78-
uses: actions/upload-artifact@v3
79-
with:
80-
name: build-artifacts
81-
path: |
82-
build/openems-edge.jar
83-
build/openems-backend.jar
84-
8569
build-ui:
8670
runs-on: ubuntu-latest
8771
steps:
@@ -110,44 +94,4 @@ jobs:
11094
node_modules/.bin/ng build -c "openems,openems-edge-prod,prod"
11195
node_modules/.bin/ng lint
11296
export CHROME_BIN=/usr/bin/google-chrome-stable
113-
npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
114-
115-
#
116-
# Is this a Tag? Prepare release assets
117-
#
118-
- name: Prepare UI asset
119-
if: startsWith(github.ref, 'refs/tags/')
120-
run: |
121-
mkdir build
122-
cd ui/target
123-
zip -r ../../build/openems-ui.zip ./*
124-
125-
- name: Save build-artifacts
126-
if: startsWith(github.ref, 'refs/tags/')
127-
uses: actions/upload-artifact@v3
128-
with:
129-
name: build-artifacts
130-
path: build/openems-ui.zip
131-
132-
#
133-
# Is this a Tag? Create a draft release
134-
#
135-
release:
136-
runs-on: ubuntu-latest
137-
needs: [build-java, build-ui]
138-
if: startsWith(github.ref, 'refs/tags/')
139-
steps:
140-
- name: Load build-artifacts
141-
uses: actions/download-artifact@v3
142-
with:
143-
name: build-artifacts
144-
path: build
145-
146-
- name: Create draft Release
147-
uses: softprops/action-gh-release@v1
148-
with:
149-
draft: true
150-
files: |
151-
build/openems-edge.jar
152-
build/openems-backend.jar
153-
build/openems-ui.zip
97+
npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI

.github/workflows/release.yml

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Prepare OpenEMS Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*.*.*"
7+
8+
jobs:
9+
build-java:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Setup Java 17
15+
uses: actions/setup-java@v3
16+
with:
17+
distribution: 'temurin'
18+
java-version: '17'
19+
cache: gradle
20+
21+
- uses: kiancross/checkstyle-annotations-action@v1
22+
23+
- name: Validate BackendApp.bndrun and EdgeApp.bndrun
24+
run: git diff --exit-code io.openems.backend.application/BackendApp.bndrun io.openems.edge.application/EdgeApp.bndrun
25+
26+
- name: Clean Edge+Backend assets
27+
run: ./gradlew cleanEdge cleanBackend
28+
29+
- name: Prepare Edge+Backend assets
30+
run: ./gradlew buildEdge buildBackend
31+
32+
- name: Save build-artifacts
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: build-artifacts
36+
path: |
37+
build/openems-edge.jar
38+
build/openems-backend.jar
39+
40+
build-ui:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v3
44+
45+
- name: Setup Node.js
46+
uses: actions/setup-node@v3
47+
with:
48+
node-version: '16'
49+
50+
- name: Setup Cache for Node.js
51+
uses: actions/cache@v3
52+
with:
53+
path: |
54+
~/.npm
55+
~/.ng
56+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
57+
restore-keys: ${{ runner.os }}-node-
58+
59+
- name: Build OpenEMS UI
60+
run: |
61+
cd ui
62+
npm install
63+
npm ci --prefer-offline --cache ~/.npm
64+
node_modules/.bin/ng config cli.cache.path "~/.ng"
65+
node_modules/.bin/ng build -c "openems,openems-edge-prod,prod"
66+
67+
- name: Prepare UI asset
68+
run: |
69+
mkdir build
70+
cd ui/target
71+
zip -r ../../build/openems-ui.zip ./*
72+
73+
- name: Save build-artifacts
74+
uses: actions/upload-artifact@v3
75+
with:
76+
name: build-artifacts
77+
path: build/openems-ui.zip
78+
79+
release:
80+
runs-on: ubuntu-latest
81+
needs: [build-java, build-ui]
82+
steps:
83+
- name: Load build-artifacts
84+
uses: actions/download-artifact@v3
85+
with:
86+
name: build-artifacts
87+
path: build
88+
89+
- name: Create draft Release
90+
uses: softprops/action-gh-release@v1
91+
with:
92+
draft: true
93+
files: |
94+
build/openems-edge.jar
95+
build/openems-backend.jar
96+
build/openems-ui.zip

0 commit comments

Comments
 (0)