Skip to content

Commit d6af39b

Browse files
authored
Merge pull request #3 from deepnote/js/publish-github-package
Github action to publish the package
2 parents 603cb1a + 48ce253 commit d6af39b

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish
2+
on:
3+
push:
4+
tags:
5+
# This is triggered when new tag starting with v is pushed to the repository.
6+
- v**
7+
8+
jobs:
9+
publish:
10+
name: Publish
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Read the tag name
16+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
17+
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 16.x
21+
cache: 'yarn'
22+
23+
- name: Set package version from git tag
24+
run: |
25+
GIT_TAG=${{ github.ref_name }}
26+
VERSION="${GIT_TAG#v}"
27+
yarn workspace sql-language-server version --new-version ${VERSION} --no-git-tag-version
28+
29+
- run: yarn install
30+
- run: yarn npm:prepublish
31+
32+
# We rename the package dynamically to include the @deepnote namespace
33+
# in the build script instead of renaming it in the package.json
34+
# because other packages depend on it and we want to keep the name the same for tests to pass.
35+
- name: Rename the package
36+
run: npm pkg set name=@deepnote/sql-language-server --workspace packages/server
37+
38+
- name: Configure github packages npm repository
39+
run: |
40+
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
41+
echo "@deepnote:registry=https://npm.pkg.github.com" >> ~/.npmrc
42+
43+
# We use `npm publish` instead of `yarn publish` because yarn publish
44+
# checks if the repository is clean and fails if it's not. This is complicated for us, given we rename
45+
# the pacakge dynamically and we don't want to commit the changes to the package.json.
46+
- name: Publish the server package
47+
run: |
48+
npm publish --workspace packages/server

0 commit comments

Comments
 (0)