mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-11 21:40:02 -04:00
add publish step to github action workflow
This commit is contained in:
parent
e3302e8e14
commit
647ee6a78a
3 changed files with 50 additions and 2 deletions
47
.github/workflows/main.yml
vendored
47
.github/workflows/main.yml
vendored
|
@ -58,6 +58,7 @@ jobs:
|
|||
path: |
|
||||
dist/*.js
|
||||
dist/*.js.map
|
||||
dist/*.wasm
|
||||
tests:
|
||||
name: Run Scramjet Tests
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -123,6 +124,52 @@ jobs:
|
|||
artifacts: "mercuryworkshop-scramjet-*.tgz"
|
||||
prerelease: true
|
||||
|
||||
publish:
|
||||
name: Publish Scramjet to NPM
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build, tests]
|
||||
if: false
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "20"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- name: Get artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: packaged-scramjet
|
||||
path: .
|
||||
|
||||
- name: Extract package
|
||||
run: tar xvf mercuryworkshop-scramjet-*.tgz package --strip-components=1
|
||||
|
||||
- name: Check the version
|
||||
id: check
|
||||
run: |
|
||||
CURRENT_VERSION=$(jq -r .version package.json)
|
||||
echo "Current version: $CURRENT_VERSION"
|
||||
LATEST_VERSION=$(npm view @mercuryworkshop/scramjet version || echo "0.0.0")
|
||||
echo "Latest NPM version: $LATEST_VERSION"
|
||||
|
||||
if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ];
|
||||
then
|
||||
echo "Version changed"
|
||||
echo "version_changed=true" >> $GITHUB_OUTPUT
|
||||
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Version not changed"
|
||||
echo "version_changed=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Publish
|
||||
if: steps.check.outputs.version_changed == 'true'
|
||||
run: npm publish --access public --no-git-checks
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
pages:
|
||||
name: Upload to Github Pages
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
"files": [
|
||||
"dist/*.js",
|
||||
"dist/*.js.map",
|
||||
"dist/*.wasm",
|
||||
"lib"
|
||||
],
|
||||
"keywords": [],
|
||||
|
|
|
@ -13,11 +13,11 @@ export default defineConfig({
|
|||
? [
|
||||
[
|
||||
"@estruyf/github-actions-reporter",
|
||||
<GitHubActionOptions>{
|
||||
{
|
||||
title: "Test summary",
|
||||
useDetails: true,
|
||||
showError: true,
|
||||
},
|
||||
} as GitHubActionOptions,
|
||||
],
|
||||
["github"],
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue