Skip to content

Commit

Permalink
Adjust cicd workflows to publish release and snapshot/prerelease tags…
Browse files Browse the repository at this point in the history
… slightly differently.
  • Loading branch information
greinard committed Sep 8, 2023
1 parent 50d5671 commit c421a92
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Publish to npmjs
name: Publish to npmjs and ProGet (releases)

on:
workflow_dispatch:
push:
tags:
- '*.*.*'
- "!*-*"

permissions:
id-token: write
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/cicd-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish to npmjs and ProGet (snapshots / prereleases)

on:
workflow_dispatch:
push:
tags:
- "*-*"

permissions:
id-token: write
contents: read

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "17.3.0"
- name: Install Dependencies
run: npm ci
- name: Run Build
run: npm run rollup
- name: Deploy to npmjs
run: |
npm config set @careevolution:registry=https://registry.npmjs.org/
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPMJS_TOKEN }}
npm publish --tag next --access public
- name: Deploy to ProGet
run: |
echo "@careevolution:registry=https://proget.careevolution.com/npm/npm/" > .npmrc
npm config set @careevolution:registry=https://proget.careevolution.com/npm/npm/
npm config set //proget.careevolution.com/npm/npm/:_authToken ${{ secrets.PROGET_TOKEN }}
npm publish --tag next
12 changes: 12 additions & 0 deletions Snapshot.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$branch= &git rev-parse --abbrev-ref HEAD

if($branch -eq "main"){
throw 'Cannot snapshot the main branch'
}

$branch = ($branch -split "/")[-1]

$newVersion = npm version prerelease --preid $branch
echo $newVersion
git push
git push origin $newVersion

0 comments on commit c421a92

Please sign in to comment.