-
Notifications
You must be signed in to change notification settings - Fork 31
75 lines (72 loc) · 2.66 KB
/
npm-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: cmf-cli
on:
# workflow_dispatch:
# inputs:
# tag:
# description: 'Main tag to publish'
release:
types: [published]
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- uses: actions/[email protected]
with:
dotnet-version: '8.0.x'
- name: install zip
uses: montudor/[email protected]
- run: npm install
- run: npm run build:prod
- name: create artifact win-x64
run: zip -X -r ../cmf-cli.win-x64.zip .
working-directory: dist/win-x64
- name: Create artifact linux-x64
run: zip -X -r ../cmf-cli.linux-x64.zip .
working-directory: dist/linux-x64
- name: Create artifact osx-x64
run: zip -X -r ../cmf-cli.osx-x64.zip .
working-directory: dist/osx-x64
- name: Publish win-x64 to release
uses: JasonEtco/upload-to-release@master
with:
args: dist/cmf-cli.win-x64.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish linux-x64 to release
uses: JasonEtco/upload-to-release@master
with:
args: dist/cmf-cli.linux-x64.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish osx-x64 to release
uses: JasonEtco/upload-to-release@master
with:
args: dist/cmf-cli.osx-x64.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm run publish
if: "github.event.release.prerelease"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm run publish:live
if: "!github.event.release.prerelease"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Re-version Core Nuget for pre-release
if: "github.event.release.prerelease"
run: sed -i.orig -E 's/([0-9]+)\.([0-9]+)\.([0-9]+)-([0-9]+)/\1\.\2\.\3-pre.\4/' core.csproj
working-directory: ./core
- name: Publish Core NuGet
id: publish_nuget
uses: alirezanet/[email protected]
with:
PROJECT_FILE_PATH: core/core.csproj
TAG_COMMIT: false
NUGET_KEY: ${{secrets.NUGET_API_KEY}}