mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Updated release process for Search and Comments UI (#22146)
ref https://github.com/TryGhost/Ghost/pull/22127 The update to the Portal release process has now been tested on main, it would be good to get Search & Comments updated to the same process so that it's easier to reason about releasing all of them.
This commit is contained in:
parent
596dfd35f6
commit
c4d60193f4
5 changed files with 146 additions and 8 deletions
4
.github/scripts/release-apps.js
vendored
4
.github/scripts/release-apps.js
vendored
|
@ -7,7 +7,9 @@ const semver = require('semver');
|
|||
|
||||
// Maps a package name to the config key in defaults.json
|
||||
const CONFIG_KEYS = {
|
||||
'@tryghost/portal': 'portal'
|
||||
'@tryghost/portal': 'portal',
|
||||
'@tryghost/sodo-search': 'sodoSearch',
|
||||
'@tryghost/comments-ui': 'comments'
|
||||
};
|
||||
|
||||
const CURRENT_DIR = process.cwd();
|
||||
|
|
135
.github/workflows/ci.yml
vendored
135
.github/workflows/ci.yml
vendored
|
@ -1138,3 +1138,138 @@ jobs:
|
|||
with:
|
||||
url: |
|
||||
https://cdn.jsdelivr.net/ghost/portal@~{{ env.current_minor }}/umd/portal.min.js
|
||||
|
||||
publish_search:
|
||||
needs: [
|
||||
job_setup,
|
||||
job_lint,
|
||||
job_unit-tests
|
||||
]
|
||||
name: Publish @tryghost/sodo-search
|
||||
runs-on: ubuntu-latest
|
||||
if: always() && needs.job_setup.result == 'success' && needs.job_lint.result == 'success' && needs.job_unit-tests.result == 'success' && needs.job_setup.outputs.is_main == 'true'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Restore caches
|
||||
uses: ./.github/actions/restore-cache
|
||||
env:
|
||||
DEPENDENCY_CACHE_KEY: ${{ needs.job_setup.outputs.dependency_cache_key }}
|
||||
|
||||
- name: Check if version changed
|
||||
id: version_check
|
||||
working-directory: apps/sodo-search
|
||||
run: |
|
||||
CURRENT_VERSION=$(cat package.json | jq -r .version)
|
||||
PUBLISHED_VERSION=$(npm show @tryghost/sodo-search version || echo "0.0.0")
|
||||
echo "Current version: $CURRENT_VERSION"
|
||||
echo "Published version: $PUBLISHED_VERSION"
|
||||
|
||||
CURRENT_MINOR=$(cat package.json | jq -r .version | awk -F. '{print $1"."$2}')
|
||||
echo "current_minor=$CURRENT_MINOR" >> $GITHUB_ENV
|
||||
|
||||
if [ "$CURRENT_VERSION" = "$PUBLISHED_VERSION" ]; then
|
||||
echo "Version is unchanged."
|
||||
echo "version_changed=false" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Version has changed."
|
||||
echo "version_changed=true" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Build the package
|
||||
if: env.version_changed == 'true'
|
||||
run: yarn run nx build @tryghost/sodo-search
|
||||
|
||||
- name: Configure .npmrc
|
||||
if: env.version_changed == 'true'
|
||||
run: |
|
||||
echo "@tryghost:registry=https://registry.npmjs.org/" >> ~/.npmrc
|
||||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
|
||||
|
||||
- name: Publish to npm
|
||||
if: env.version_changed == 'true'
|
||||
working-directory: apps/sodo-search
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: npm publish --access public
|
||||
|
||||
- name: Purge jsdelivr cache
|
||||
if: env.version_changed == 'true'
|
||||
uses: gacts/purge-jsdelivr-cache@v1
|
||||
with:
|
||||
url: |
|
||||
https://cdn.jsdelivr.net/ghost/sodo-search@~{{ env.current_minor }}/umd/sodo-search.min.js
|
||||
https://cdn.jsdelivr.net/ghost/sodo-search@~{{ env.current_minor }}/umd/main.css
|
||||
|
||||
publish_comments:
|
||||
needs: [
|
||||
job_setup,
|
||||
job_lint,
|
||||
job_unit-tests
|
||||
]
|
||||
name: Publish @tryghost/comments-ui
|
||||
runs-on: ubuntu-latest
|
||||
if: always() && needs.job_setup.result == 'success' && needs.job_lint.result == 'success' && needs.job_unit-tests.result == 'success' && needs.job_setup.outputs.is_main == 'true'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Restore caches
|
||||
uses: ./.github/actions/restore-cache
|
||||
env:
|
||||
DEPENDENCY_CACHE_KEY: ${{ needs.job_setup.outputs.dependency_cache_key }}
|
||||
|
||||
- name: Check if version changed
|
||||
id: version_check
|
||||
working-directory: apps/comments-ui
|
||||
run: |
|
||||
CURRENT_VERSION=$(cat package.json | jq -r .version)
|
||||
PUBLISHED_VERSION=$(npm show @tryghost/comments-ui version || echo "0.0.0")
|
||||
echo "Current version: $CURRENT_VERSION"
|
||||
echo "Published version: $PUBLISHED_VERSION"
|
||||
|
||||
CURRENT_MINOR=$(cat package.json | jq -r .version | awk -F. '{print $1"."$2}')
|
||||
echo "current_minor=$CURRENT_MINOR" >> $GITHUB_ENV
|
||||
|
||||
if [ "$CURRENT_VERSION" = "$PUBLISHED_VERSION" ]; then
|
||||
echo "Version is unchanged."
|
||||
echo "version_changed=false" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Version has changed."
|
||||
echo "version_changed=true" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Build the package
|
||||
if: env.version_changed == 'true'
|
||||
run: yarn run nx build @tryghost/comments-ui
|
||||
|
||||
- name: Configure .npmrc
|
||||
if: env.version_changed == 'true'
|
||||
run: |
|
||||
echo "@tryghost:registry=https://registry.npmjs.org/" >> ~/.npmrc
|
||||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
|
||||
|
||||
- name: Publish to npm
|
||||
if: env.version_changed == 'true'
|
||||
working-directory: apps/comments-ui
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: npm publish --access public
|
||||
|
||||
- name: Purge jsdelivr cache
|
||||
if: env.version_changed == 'true'
|
||||
uses: gacts/purge-jsdelivr-cache@v1
|
||||
with:
|
||||
url: |
|
||||
https://cdn.jsdelivr.net/ghost/comments-ui@~{{ env.current_minor }}/umd/comments-ui.min.js
|
||||
|
|
|
@ -19,15 +19,18 @@ A patch release can be rolled out instantly in production, whereas a minor/major
|
|||
### Patch release
|
||||
|
||||
1. Run `yarn ship` and select a patch version when prompted
|
||||
2. (Optional) Clear JsDelivr cache to get the new version out instantly ([docs](https://www.notion.so/ghost/How-to-clear-jsDelivr-CDN-cache-2930bdbac02946eca07ac23ab3199bfa?pvs=4)). Typically, you'll need to open `https://purge.jsdelivr.net/ghost/comments-ui@~${COMMENTS_UI_VERSION}/umd/comments-ui.min.js` and
|
||||
`https://purge.jsdelivr.net/ghost/comments-ui@~${COMMENTS_UI_VERSION}/umd/main.css` in your browser, where `COMMENTS_UI_VERSION` is the latest minor version in `ghost/core/core/shared/config/defaults.json` ([code](https://github.com/TryGhost/Ghost/blob/0aef3d3beeebcd79a4bfd3ad27e0ac67554b5744/ghost/core/core/shared/config/defaults.json#L198))
|
||||
2. Merge the release commit to `main`
|
||||
|
||||
### Minor / major release
|
||||
|
||||
1. Run `yarn ship` and select a minor or major version when prompted
|
||||
2. Update the Comments UI version in `ghost/core/core/shared/config/defaults.json` to the new minor or major version ([code](https://github.com/TryGhost/Ghost/blob/0aef3d3beeebcd79a4bfd3ad27e0ac67554b5744/ghost/core/core/shared/config/defaults.json#L198))
|
||||
2. Merge the release commit to `main`
|
||||
3. Wait until a new version of Ghost is released
|
||||
|
||||
### JsDelivr cache
|
||||
If the CI doesn't clear JsDelivr cache to get the new version out instantly, you may want to do it yourself manually ([docs](https://www.notion.so/ghost/How-to-clear-jsDelivr-CDN-cache-2930bdbac02946eca07ac23ab3199bfa?pvs=4)). Typically, you'll need to open `https://purge.jsdelivr.net/ghost/comments-ui@~${COMMENTS_UI_VERSION}/umd/comments-ui.min.js` and
|
||||
`https://purge.jsdelivr.net/ghost/comments-ui@~${COMMENTS_UI_VERSION}/umd/main.css` in your browser, where `COMMENTS_UI_VERSION` is the latest minor version in `ghost/core/core/shared/config/defaults.json` ([code](https://github.com/TryGhost/Ghost/blob/0aef3d3beeebcd79a4bfd3ad27e0ac67554b5744/ghost/core/core/shared/config/defaults.json#L198))
|
||||
|
||||
# Copyright & License
|
||||
|
||||
Copyright (c) 2013-2025 Ghost Foundation - Released under the [MIT license](LICENSE).
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
"test:e2e:full": "ALL_BROWSERS=1 yarn test:e2e",
|
||||
"lint": "eslint src --ext .js,.ts,.jsx,.tsx --cache",
|
||||
"preship": "yarn lint",
|
||||
"ship": "STATUS=$(git status --porcelain .); echo $STATUS; if [ -z \"$STATUS\" ]; then yarn version; else echo \"Uncommitted changes found.\" && exit 1; fi",
|
||||
"postship": "git push ${GHOST_UPSTREAM:-origin} --follow-tags && npm publish",
|
||||
"ship": "node ../../.github/scripts/release-apps.js",
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"browserslist": {
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
"test:unit": "yarn test:ci",
|
||||
"lint": "eslint src --ext .js --cache",
|
||||
"preship": "yarn lint",
|
||||
"ship": "STATUS=$(git status --porcelain .); echo $STATUS; if [ -z \"$STATUS\" ]; then yarn version; else echo \"Uncommitted changes found.\" && exit 1; fi",
|
||||
"postship": "git push ${GHOST_UPSTREAM:-origin} --follow-tags && npm publish",
|
||||
"ship": "node ../../.github/scripts/release-apps.js",
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"eslintConfig": {
|
||||
|
|
Loading…
Add table
Reference in a new issue