Skip to content

Commit

Permalink
Add publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownskl committed Nov 6, 2023
1 parent 2dc93a0 commit 581ac26
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
48 changes: 48 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: NPM Publish

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
# the Node.js versions to build on
node-version: [18.x]

steps:
- uses: actions/checkout@v3.6.0
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo

- name: Get tag name
id: tag_name
run: |
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Install dependencies
run: npm ci

- name: Build the project
run: npm run build

- name: Run NodeJS Tests
run: npm run test

- name: NPM publish beta package
if: ${{ contains(steps.tag_name.outputs.SOURCE_TAG, 'beta') }}
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
tag: beta

- name: NPM publish package
if: ${{ !contains(steps.tag_name.outputs.SOURCE_TAG, 'beta') }}
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xal-node",
"version": "1.0.0",
"version": "1.0.0-beta1",
"description": "XAL implementation in Typescript. Used for authenticating to services like Xbox.",
"main": "dist/lib.js",
"scripts": {
Expand Down

0 comments on commit 581ac26

Please sign in to comment.