Skip to content

Commit 56fa585

Browse files
committed
Fix versioning on release workflow
1 parent 2ed7e2f commit 56fa585

File tree

2 files changed

+23
-28
lines changed

2 files changed

+23
-28
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v2
1717
- uses: actions/setup-node@v3
1818
with:
19-
node-version: 16
19+
node-version: 18
2020
- name: Install npm packages
2121
run: |-
2222
npm ci

.github/workflows/release.yml

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,40 @@ jobs:
1111
build:
1212
name: Build and Test
1313
runs-on: ubuntu-latest
14+
outputs:
15+
version: ${{ steps.set_package_version.outputs.NpmPackageVersion }}
16+
releaseTag: ${{ steps.tagInfo.outputs.releaseTag }}
1417
steps:
15-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
1619
with:
1720
fetch-depth: 0 # avoid shallow clone (required by Nerbank GitVersioning)
18-
- uses: actions/setup-dotnet@v1 # .NET Core is required in order to use nerdbank-gitversioning
19-
with:
20-
dotnet-version: 3.1.301
21+
# - uses: actions/setup-dotnet@v1 # .NET Core is required in order to use nerdbank-gitversioning
22+
# with:
23+
# dotnet-version: 3.1.301
2124
- uses: actions/setup-node@v3
2225
with:
23-
node-version: 16
26+
node-version: 18
2427
- name: Install npm packages
2528
run: npm ci
2629
- name: Update package version
2730
id: set_package_version
28-
run: npm run set-packageversion
31+
uses: dotnet/nbgv@master
32+
with:
33+
stamp: cucumber-tsflow/package.json
2934
- name: Build
3035
run: npm run build
31-
- name: Run specification tests
32-
run: npm test
3336
- name: Create npm package
3437
run: npm pack ./cucumber-tsflow
35-
- name: Create version info file
38+
- name: Read tag info
39+
id: tagInfo
3640
run: |-
37-
echo "${{ steps.set_package_version.outputs.package_version }}" > versioninfo.txt
38-
jq '.releaseTag // "latest"' version.json > releasetag.txt
39-
- uses: actions/upload-artifact@v2
41+
echo "releaseTag=$(jq '.releaseTag // "latest"' version.json)" | tee -a $GITHUB_OUTPUT
42+
- uses: actions/upload-artifact@v3
4043
with:
4144
name: npm-package
4245
path: |
43-
versioninfo.txt
44-
releasetag.txt
45-
cucumber-tsflow-${{ steps.set_package_version.outputs.package_version }}.tgz
46+
cucumber-tsflow-${{ steps.set_package_version.outputs.NpmPackageVersion }}.tgz
47+
4648
# Publish the 'cucumber-tsflow' package to npm
4749
publish:
4850
name: Publish to npm
@@ -53,30 +55,23 @@ jobs:
5355
steps:
5456
- uses: actions/setup-node@v3
5557
with:
56-
node-version: 16
58+
node-version: 18
5759
registry-url: 'https://registry.npmjs.org'
5860
- uses: actions/download-artifact@v2
5961
name: Download npm package
6062
with:
6163
name: npm-package
62-
- name: Read version info file
63-
id: get_package_version
64-
run: |
65-
VER=`cat versioninfo.txt`
66-
echo "::set-output name=package_version::$VER"
67-
TAG=`cat releasetag.txt`
68-
echo "::set-output name=release_tag::$TAG"
6964
- name: Publish npm package
7065
run: |-
7166
npm publish \
72-
cucumber-tsflow-${{ steps.get_package_version.outputs.package_version }}.tgz \
73-
--tag ${{ steps.get_package_version.outputs.release_tag }}
67+
cucumber-tsflow-${{ needs.build.outputs.version }}.tgz \
68+
--tag ${{ needs.build.outputs.releaseTag }}
7469
env:
7570
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7671
- name: Publish GitHub release
7772
uses: ncipollo/release-action@v1
7873
with:
79-
tag: ${{ steps.get_package_version.outputs.package_version }}
74+
tag: ${{ needs.build.outputs.version }}
8075
commit: ${{ github.sha }}
81-
artifacts: cucumber-tsflow-${{ steps.get_package_version.outputs.package_version }}.tgz
76+
artifacts: cucumber-tsflow-${{ needs.build.outputs.version }}.tgz
8277
generateReleaseNotes: true

0 commit comments

Comments
 (0)