Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix automated releases #13834

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .github/workflows/publish-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,16 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Publish NPM
shell: bash
run: |
yarn publish:next
# We need to retry the publish command in case of network errors.
# Those errors are usually due to rate limiting on the NPM registry.
uses: nick-invision/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
timeout_minutes: 5
retry_wait_seconds: 30
max_attempts: 3
retry_on: error
command: yarn publish:next
on_retry_command: git reset --hard
env:
NPM_CONFIG_PROVENANCE: "true"
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
26 changes: 19 additions & 7 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,16 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Publish NPM
shell: bash
run: |
yarn publish:latest -- ${{ inputs.release_type }}
yarn publish:check
# We need to retry the publish command in case of network errors.
# Those errors are usually due to rate limiting on the NPM registry.
uses: nick-invision/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
timeout_minutes: 5
retry_wait_seconds: 30
max_attempts: 3
retry_on: error
command: yarn publish:latest -- ${{ inputs.release_type }} && yarn publish:check
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The publishing guide recommends using a specific command in case of publishing errors:
https://github.com/eclipse-theia/theia/blob/master/doc/Publishing.md#failures-during-publishing
npx lerna publish from-package --no-git-reset --no-git-tag-version --no-push

I'm not familiar with the reasoning behind this choice. Maybe @vince-fugnitto could provide some insight?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jfaltermeier in the past we often encountered NPM socket errors which meant that only a subset of extensions were successfully published. In this state we cannot re-perform the publishing as it would fail with a message that the extension was already published. In order to only publish the extensions which were not previously published we manually ran the steps referenced in failure-during-publishing to continue with the release.

It's possible that the proposed workflow will fail when retrying if we are in a state where we partially published extensions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we run git reset --hard in between retries, running lerna publish from-package is not necessary. Just repeating the publish:latest command should work as expected. I don't think we need to adjust something.

Also, having two separate commands in the CI (for normal publishing + publishing following an error) would make this more complicated to maintain imo.

on_retry_command: git reset --hard
env:
NPM_CONFIG_PROVENANCE: "true" # enable provenance check
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
Expand All @@ -62,12 +68,18 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@3cf273023a0dda27efcd3164bdfb51908dd46a5b # v1.3.1
with:
path: packages/core

- name: Create Pull Request
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
with:
commiter: ${{ github.actor }} <${{ fromJson(steps.actor_user_data.outputs.data).email }}>
author: ${{ github.actor }} <${{ fromJson(steps.actor_user_data.outputs.data).email }}>
branch: bot/package-update
title: Package update for version ${{ env.NEXT_VERSION_NUMBER }}
commit-message: Package update for version ${{ env.NEXT_VERSION_NUMBER }}
body: Automated package update for Theia version ${{ env.NEXT_VERSION_NUMBER }}. Triggered by @${{ github.actor }}.
title: Package update for version ${{ steps.package-version.outputs.current-version}}
commit-message: Package update for version ${{ steps.package-version.outputs.current-version}}
body: Automated package update for Theia version ${{ steps.package-version.outputs.current-version}}. Triggered by @${{ github.actor }}.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"postinstall": "theia-patch",
"prepare": "yarn -s compile:references && lerna run prepare && yarn -s compile",
"publish:latest": "lerna publish --exact --yes --no-push",
"publish:next": "lerna publish preminor --exact --canary --preid next --dist-tag next --no-git-reset --no-git-tag-version --no-push --yes && yarn -s publish:check",
"publish:next": "lerna publish preminor --exact --preid next --dist-tag next --no-git-reset --no-git-tag-version --no-push --yes && yarn -s publish:check",
"publish:check": "node scripts/check-publish.js",
"rebuild:clean": "rimraf .browser_modules",
"test": "yarn -s test:theia && yarn -s electron test && yarn -s browser test",
Expand Down Expand Up @@ -114,4 +114,4 @@
"vscode.microsoft-authentication",
"ms-vscode.references-view"
]
}
}
Loading