Skip to content

Commit

Permalink
add-github-package
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangnanscu committed Feb 23, 2024
1 parent 0fd8edc commit 21e14b6
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/publish-package-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish to GitHub Packages

on:
push:
paths: "package.json"

jobs:
publish-gpr:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
submodules: true
- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "xiangnanscu-ci"
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: https://npm.pkg.github.com/
- 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 github
if: steps.version_changed.outputs.changed == 'true'
run: |
corepack enable
npm i
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
2 changes: 1 addition & 1 deletion .github/workflows/publish-package-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "xiangnanscu"
git config --global user.name "xiangnanscu-ci"
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xiangnanscu/lua2js",
"version": "0.24.0",
"version": "0.25.0",
"main": "src/lua2js.mjs",
"type": "module",
"bin": {
Expand Down

0 comments on commit 21e14b6

Please sign in to comment.