Skip to content

Commit

Permalink
chore: move main pkg to a different job
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Jan 25, 2024
1 parent da3db98 commit c79c942
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
26 changes: 19 additions & 7 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
include: LICENSE,README.md
token: ${{ secrets.GITHUB_TOKEN }}

npm-publish:
npm-publish-arch:
needs: binary-builds
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
echo "node_pkg=${node_pkg}" >> "$GITHUB_ENV"
cd homestar-runtime/npm
mkdir -p "${node_pkg}/bin"
envsubst < package.json.tmpl > "${node_pkg}/package.json"
envsubst < package-json-arch.tmpl > "${node_pkg}/package.json"
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -171,12 +171,24 @@ jobs:
npm publish --access public --tag rc
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

npm-publish-main:
needs: npm-publish-arch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: 'https://registry.npmjs.org'
- name: Install cargo get
run: cargo install cargo-get
- name: Publish main package to production
if: github.event_name == 'release' && github.event.action == 'published'
run: |
cp homestar-runtime/README.md "homestar-runtime/npm/base"
cd homestar-runtime/npm
export node_version=$(cargo get workspace.package.version)
cp homestar-runtime/README.md homestar-runtime/npm/base
cd homestar-runtime/npm
envsubst < package-json-base.tmpl > "base/package.json"
cd base
npm publish --access=public
Expand All @@ -185,15 +197,15 @@ jobs:
- name: Publish main package RC
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.force-builds)
run: |
cp homestar-runtime/README.md "homestar-runtime/npm/base"
cd homestar-runtime/npm
export node_version="$(cargo get workspace.package.version)-rc.$(date +%s)"
cp homestar-runtime/README.md homestar-runtime/npm/base
cd homestar-runtime/npm
envsubst < package-json-base.tmpl > "base/package.json"
cd base
npm publish --access public --tag rc
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

build-packages:
needs: binary-builds
runs-on: ubuntu-latest
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions homestar-runtime/npm/package-json-base.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"name": "homestar-runtime",
"version": "${node_version}",
"description": "The IPVM reference implementation",
"author": "Hugo Dias <[email protected]>
(hugodias.me)",
"author": "Hugo Dias <[email protected]> (hugodias.me)",
"homepage": "https://github.com/ipvm-wg/homestar/tree/main/homestar-runtime",
"repository": {
"url": "ipvm-wg/homestar",
Expand Down

0 comments on commit c79c942

Please sign in to comment.