From 1f184338e3f435ef42f0d7b08ecf069505ff7101 Mon Sep 17 00:00:00 2001 From: ondrejromancov Date: Fri, 14 Jun 2024 11:46:59 +0200 Subject: [PATCH 1/2] Add a separate publishing job for sql-parser package --- .github/workflows/publish.yaml | 50 ++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index dcd07316..1f2670aa 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -6,8 +6,8 @@ on: - v** jobs: - publish: - name: Publish + publish-server: + name: Publish Server runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -42,7 +42,47 @@ jobs: # We use `npm publish` instead of `yarn publish` because yarn publish # checks if the repository is clean and fails if it's not. This is complicated for us, given we rename - # the pacakge dynamically and we don't want to commit the changes to the package.json. + # the package dynamically and we don't want to commit the changes to the package.json. - name: Publish the server package - run: | - npm publish --workspace packages/server + run: npm publish --workspace packages/server + + publish-sql-parser: + name: Publish SQL Parser + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Read the tag name + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: 'yarn' + + - name: Set package version from git tag + run: | + GIT_TAG=${{ github.ref_name }} + VERSION="${GIT_TAG#v}" + yarn workspace sql-parser version --new-version ${VERSION} --no-git-tag-version + + - run: yarn install + - run: yarn npm:prepublish + + # We rename the package dynamically to include the @deepnote namespace + # in the build script instead of renaming it in the package.json + # because other packages depend on it and we want to keep the name the same for tests to pass. + - name: Rename the package + run: npm pkg set name=@deepnote/sql-parser --workspace packages/sql-parser + + - name: Configure github packages npm repository + run: | + echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc + echo "@deepnote:registry=https://npm.pkg.github.com" >> ~/.npmrc + # We use `npm publish` instead of `yarn publish` because yarn publish + + # We use `npm publish` instead of `yarn publish` because yarn publish + # checks if the repository is clean and fails if it's not. This is complicated for us, given we rename + # the package dynamically and we don't want to commit the changes to the package.json. + - name: Publish the sql-parser package + run: npm publish --workspace packages/sql-parser \ No newline at end of file From c2343c4df6022e5cbf6fbb0fb1476aee1dfb981a Mon Sep 17 00:00:00 2001 From: ondrejromancov Date: Fri, 14 Jun 2024 11:48:45 +0200 Subject: [PATCH 2/2] Switch the two jobs around and add a dependency of server package on sql-parser --- .github/workflows/publish.yaml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 1f2670aa..7b6cabcf 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -6,8 +6,8 @@ on: - v** jobs: - publish-server: - name: Publish Server + publish-sql-parser: + name: Publish SQL Parser runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -24,7 +24,7 @@ jobs: run: | GIT_TAG=${{ github.ref_name }} VERSION="${GIT_TAG#v}" - yarn workspace sql-language-server version --new-version ${VERSION} --no-git-tag-version + yarn workspace sql-parser version --new-version ${VERSION} --no-git-tag-version - run: yarn install - run: yarn npm:prepublish @@ -33,22 +33,24 @@ jobs: # in the build script instead of renaming it in the package.json # because other packages depend on it and we want to keep the name the same for tests to pass. - name: Rename the package - run: npm pkg set name=@deepnote/sql-language-server --workspace packages/server - + run: npm pkg set name=@deepnote/sql-parser --workspace packages/sql-parser + - name: Configure github packages npm repository run: | echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc echo "@deepnote:registry=https://npm.pkg.github.com" >> ~/.npmrc + # We use `npm publish` instead of `yarn publish` because yarn publish # We use `npm publish` instead of `yarn publish` because yarn publish # checks if the repository is clean and fails if it's not. This is complicated for us, given we rename # the package dynamically and we don't want to commit the changes to the package.json. - - name: Publish the server package - run: npm publish --workspace packages/server + - name: Publish the sql-parser package + run: npm publish --workspace packages/sql-parser - publish-sql-parser: - name: Publish SQL Parser + publish-server: + name: Publish Server runs-on: ubuntu-latest + needs: publish-sql-parser steps: - uses: actions/checkout@v3 @@ -64,7 +66,7 @@ jobs: run: | GIT_TAG=${{ github.ref_name }} VERSION="${GIT_TAG#v}" - yarn workspace sql-parser version --new-version ${VERSION} --no-git-tag-version + yarn workspace sql-language-server version --new-version ${VERSION} --no-git-tag-version - run: yarn install - run: yarn npm:prepublish @@ -73,16 +75,15 @@ jobs: # in the build script instead of renaming it in the package.json # because other packages depend on it and we want to keep the name the same for tests to pass. - name: Rename the package - run: npm pkg set name=@deepnote/sql-parser --workspace packages/sql-parser - + run: npm pkg set name=@deepnote/sql-language-server --workspace packages/server + - name: Configure github packages npm repository run: | echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc echo "@deepnote:registry=https://npm.pkg.github.com" >> ~/.npmrc - # We use `npm publish` instead of `yarn publish` because yarn publish # We use `npm publish` instead of `yarn publish` because yarn publish # checks if the repository is clean and fails if it's not. This is complicated for us, given we rename # the package dynamically and we don't want to commit the changes to the package.json. - - name: Publish the sql-parser package - run: npm publish --workspace packages/sql-parser \ No newline at end of file + - name: Publish the server package + run: npm publish --workspace packages/server \ No newline at end of file