Skip to content

Commit f1cbcc9

Browse files
committed
npm publish
1 parent bb700b5 commit f1cbcc9

File tree

1 file changed

+57
-2
lines changed

1 file changed

+57
-2
lines changed

.github/workflows/ci.yml

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,66 @@ jobs:
5757
# Test global install of the package
5858
- run: npm pack .
5959
- run: npm install -g solid-server-*.tgz
60+
- name: Save build
61+
# if: matrix.node-version == '20.x'
62+
uses: actions/upload-artifact@v5
63+
with:
64+
name: build
65+
path: |
66+
.
67+
!node_modules
68+
retention-days: 1
69+
70+
test-suite:
71+
needs: build
72+
runs-on: ${{ matrix.os }}
73+
steps:
6074
# Run the Solid test-suite
6175
- run: bash test/surface/run-solid-test-suite.sh $BRANCH_NAME $REPO_NAME
6276

63-
# TODO: The pipeline should automate publication to npm, so that the docker build gets the correct version
64-
# This job will only dockerize solid-server@latest / solid-server@<tag-name> from npmjs.com!
77+
# The pipeline automate publication to npm, so that the docker build gets the correct version
78+
npm-publish-build:
79+
needs: [build, test-suite]
80+
name: Publish to npm
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: actions/download-artifact@v6
84+
with:
85+
name: build
86+
- uses: actions/setup-node@v6
87+
with:
88+
node-version: 20.x
89+
- uses: rlespinasse/github-slug-action@v3.x
90+
- name: Append commit hash to package version
91+
run: 'sed -i -E "s/(\"version\": *\"[^\"]+)/\1-${GITHUB_SHA_SHORT}/" package.json'
92+
- name: Disable pre- and post-publish actions
93+
run: 'sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
94+
- uses: JS-DevTools/npm-publish@v4.1.0
95+
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
96+
with:
97+
token: ${{ secrets.NPM_TOKEN }}
98+
tag: ${{ env.GITHUB_REF_SLUG }}
99+
100+
npm-publish-latest:
101+
needs: [build, test-suite, npm-publish-build]
102+
runs-on: ubuntu-latest
103+
if: github.ref == 'refs/heads/main'
104+
steps:
105+
- uses: actions/download-artifact@v6
106+
with:
107+
name: build
108+
- uses: actions/setup-node@v6
109+
with:
110+
node-version: 20.x
111+
- name: Disable pre- and post-publish actions
112+
run: 'sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
113+
- uses: JS-DevTools/npm-publish@v4.1.0
114+
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
115+
with:
116+
token: ${{ secrets.NPM_TOKEN }}
117+
tag: latest
118+
119+
# This job will only dockerize solid-server@latest / solid-server@<tag-name> from npmjs.com!
65120
docker-hub:
66121
needs: build
67122
name: Publish to docker hub

0 commit comments

Comments
 (0)