Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangnanscu committed Feb 13, 2024
1 parent 0732392 commit c5bd6ce
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Node.js Package to Github and NPM
name: Publish to GitHub Packages

on:
push:
Expand All @@ -7,36 +7,7 @@ on:
paths: "package.json"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- run: npm i
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: https://registry.npmjs.org/
- run: npm i
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}

publish-gpr:
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
Expand All @@ -63,9 +34,9 @@ jobs:
echo "Version did not change"
echo "{changed}={false}" >> $GITHUB_OUTPUT
fi
- run: npm i
- name: Publish to npm
if: steps.version_changed.outputs.changed == 'true'
run: npm i
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
44 changes: 44 additions & 0 deletions .github/workflows/publish-package-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish to NPM Packages

on:
push:
branches:
- master
paths: "package.json"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: https://registry.npmjs.org/

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- name: Install jq
run: sudo apt-get install jq
- name: Check if version changed
id: version_changed
run: |
VERSION_OLD=$(git show ${{ github.event.before }}:package.json | jq -r .version)
VERSION_NEW=$(jq -r .version package.json)
if [ "$VERSION_OLD" != "$VERSION_NEW" ]; then
echo "Version changed from $VERSION_OLD to $VERSION_NEW"
echo "{changed}={true}" >> $GITHUB_OUTPUT
else
echo "Version did not change"
echo "{changed}={false}" >> $GITHUB_OUTPUT
fi
- name: Publish to npm
if: steps.version_changed.outputs.changed == 'true'
run: npm i
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xiangnanscu/js2lua",
"version": "0.24.0",
"version": "0.25.0",
"type": "module",
"description": "Writing LuaJIT with the expressiveness of JavaScript",
"main": "src/js2lua.mjs",
Expand Down Expand Up @@ -55,4 +55,4 @@
"vite-plugin-require-transform": "^1.0.21",
"vue-eslint-parser": "^9.3.1"
}
}
}

0 comments on commit c5bd6ce

Please sign in to comment.