Skip to content

Commit 24ae0d3

Browse files
authored
ci: version split (#42)
1 parent 88ded97 commit 24ae0d3

File tree

5 files changed

+104
-62
lines changed

5 files changed

+104
-62
lines changed

.github/workflows/integration-tests.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@ name: Run integration tests
22
on:
33
workflow_dispatch:
44
workflow_call:
5+
inputs:
6+
branch:
7+
required: false
8+
type: string
9+
description: 'Branch to run on'
510
jobs:
611
tests:
712
runs-on: ubuntu-latest
813
steps:
914
- name: Check out code
1015
uses: actions/checkout@v2
16+
with:
17+
ref: ${{ inputs.branch }}
1118

1219
- name: Set up node.js
1320
uses: actions/setup-node@v2

.github/workflows/pull-request.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: PR checks
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, 0.x ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ main, 0.x ]
88

99
jobs:
1010
code-checks:

.github/workflows/release-v0.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 0.x Release new version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
majorRelease:
7+
required: false
8+
description: 'Release as version. Example values are: minor, major, 5.6.1, 1.0.0. Leave empty for regular release.'
9+
10+
jobs:
11+
release:
12+
uses: ./.github/workflows/release-workflow.yml
13+
with:
14+
branch: 0.x
15+
majorRelease: ${{ inputs.majorRelease }}
16+
secrets: inherit
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Release new version
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
majorRelease:
7+
required: false
8+
type: string
9+
description: 'Release as version. Example values are: minor, major, 5.6.1, 1.0.0. Leave empty for regular release.'
10+
branch:
11+
required: true
12+
type: string
13+
description: 'main or 0.x branch'
14+
15+
jobs:
16+
# integration-tests:
17+
# uses: ./.github/workflows/integration-tests.yaml
18+
19+
publish:
20+
runs-on: ubuntu-latest
21+
# needs: integration-tests
22+
steps:
23+
- name: Check out code
24+
uses: actions/checkout@v2
25+
with:
26+
fetch-depth: 0
27+
ref: ${{ inputs.branch }}
28+
29+
- name: Set up node.js
30+
uses: actions/setup-node@v2
31+
with:
32+
node-version: '16'
33+
34+
- name: Install dependencies
35+
run: |
36+
npm install
37+
38+
- name: Setup git config
39+
run: |
40+
git config user.name "GitHub Actions Bot"
41+
git config user.email "<>"
42+
43+
- name: Build
44+
run: |
45+
npm run build
46+
47+
- name: Release
48+
run: |
49+
${{github.event.inputs.majorRelease != '' && format('npm run release -- --release-as {1}', github.event.inputs.majorRelease) || 'npm run release'}}
50+
51+
- name: Publish to npm
52+
run: |
53+
echo //registry.npmjs.org/:_authToken=${{secrets.NPM_PUBLISH_KEY}} >> .npmrc
54+
echo email=${{ secrets.NPM_EMAIL }} >> .npmrc
55+
echo always-auth=true >> .npmrc
56+
npm publish
57+
58+
- name: Push git tags
59+
run: |
60+
git push --follow-tags origin ${{ inputs.branch }}
61+
62+
- name: Get latest tag
63+
id: tag_generation
64+
run: |
65+
NEW_TAG=$(git describe --tags --abbrev=0)
66+
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
67+
shell: bash
68+
69+
- name: GitHub release
70+
uses: softprops/action-gh-release@v1
71+
with:
72+
generate_release_notes: true
73+
tag_name: ${{ steps.tag_generation.outputs.new_tag }}

.github/workflows/release.yaml

Lines changed: 6 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,63 +8,9 @@ on:
88
description: 'Release as version. Example values are: minor, major, 5.6.1, 1.0.0. Leave empty for regular release.'
99

1010
jobs:
11-
# integration-tests:
12-
# uses: firebolt-db/firebolt-node-sdk/.github/workflows/integration-tests.yaml@main
13-
14-
publish:
15-
runs-on: ubuntu-latest
16-
# needs: integration-tests
17-
steps:
18-
- name: Check out code
19-
uses: actions/checkout@v2
20-
with:
21-
fetch-depth: 0
22-
# token: ${{ secrets.RELEASE_PAT }}
23-
24-
- name: Set up node.js
25-
uses: actions/setup-node@v2
26-
with:
27-
node-version: '16'
28-
29-
- name: Install dependencies
30-
run: |
31-
npm install
32-
33-
- name: Setup git config
34-
run: |
35-
git config user.name "GitHub Actions Bot"
36-
git config user.email "<>"
37-
38-
- name: Build
39-
run: |
40-
npm run build
41-
42-
- name: Release
43-
run: |
44-
${{github.event.inputs.majorRelease != '' && format('npm run release -- --release-as {1}', github.event.inputs.majorRelease) || 'npm run release'}}
45-
46-
- name: Publish to npm
47-
run: |
48-
echo //registry.npmjs.org/:_authToken=${{secrets.NPM_PUBLISH_KEY}} >> .npmrc
49-
echo email=${{ secrets.NPM_EMAIL }} >> .npmrc
50-
echo always-auth=true >> .npmrc
51-
npm publish
52-
53-
- name: Push git tags
54-
run: |
55-
git push --follow-tags origin main
56-
57-
- name: Get latest tag
58-
id: tag_generation
59-
run: |
60-
NEW_TAG=$(git describe --tags --abbrev=0)
61-
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
62-
shell: bash
63-
64-
- name: GitHub release
65-
uses: softprops/action-gh-release@v1
66-
with:
67-
generate_release_notes: true
68-
tag_name: ${{ steps.tag_generation.outputs.new_tag }}
69-
70-
11+
release:
12+
uses: ./.github/workflows/release-workflow.yml
13+
with:
14+
branch: main
15+
majorRelease: ${{ inputs.majorRelease }}
16+
secrets: inherit

0 commit comments

Comments
 (0)