Skip to content

Commit 4f4f331

Browse files
WIP - update release/publish infra
Signed-off-by: Marc Dumais <[email protected]>
1 parent 32b1251 commit 4f4f331

File tree

4 files changed

+85
-55
lines changed

4 files changed

+85
-55
lines changed

.github/workflows/ci-cd.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: ci-cd
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
14+
build-and-test:
15+
name: Build and Test
16+
17+
strategy:
18+
matrix:
19+
os: [ubuntu-latest]
20+
node: ['18']
21+
java: ['11']
22+
23+
runs-on: ${{ matrix.os }}
24+
timeout-minutes: 10
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
with:
30+
fetch-depth: 1
31+
32+
- name: Use Node.js ${{ matrix.node }}
33+
uses: actions/setup-node@v3
34+
with:
35+
node-version: ${{ matrix.node }}
36+
registry-url: 'https://registry.npmjs.org'
37+
38+
- name: Use Java ${{ matrix.java }}
39+
uses: actions/setup-java@v3
40+
with:
41+
distribution: 'adopt'
42+
java-version: ${{ matrix.java }}
43+
44+
- name: Run Tests
45+
if: matrix.tests != 'skip'
46+
shell: bash
47+
run: |
48+
yarn
49+
yarn test
50+
51+
publish-latest:
52+
needs: build-and-test
53+
# if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'eclipse-dash/nodejs-wrapper'
54+
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && github.repository == 'eclipse-dash/nodejs-wrapper' && contains(github.event.head_commit.message, '[Release]: v')
55+
runs-on: ubuntu-latest
56+
strategy:
57+
matrix:
58+
node: ['18']
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v3
62+
with:
63+
fetch-depth: 0
64+
- name: Use Node.js ${{ matrix.node }}
65+
uses: actions/setup-node@v3
66+
with:
67+
node-version: ${{ matrix.node }}
68+
registry-url: 'https://registry.npmjs.org'
69+
- name: Pre-Publish
70+
shell: bash
71+
run: |
72+
yarn
73+
- name: Publish to npm
74+
uses: nick-invision/retry@v2
75+
with:
76+
timeout_minutes: 5
77+
retry_wait_seconds: 60
78+
max_attempts: 3
79+
retry_on: error
80+
command: yarn publish:ci
81+
env:
82+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

.github/workflows/ci.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/gh-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515

1616
jobs:
1717
gh-release:
18+
name: Create GitHub release
1819
runs-on: ubuntu-latest
1920
steps:
2021
- uses: actions/checkout@v3

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
},
1212
"scripts": {
1313
"start": "node src/dash-licenses-wrapper.js",
14-
"test": "mocha --reporter spec"
14+
"test": "mocha --reporter spec",
15+
"publish:ci": "yarn publish --non-interactive --access public --registry https://registry.npmjs.org/"
1516
},
1617
"files": [
1718
"src/*",

0 commit comments

Comments
 (0)