0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2024-12-30 22:34:01 -05:00

Added workflow for deploying @tryghost/admin-x-activitypub

ref https://linear.app/tryghost/issue/AP-438

This will build and release the Admin X activitypub app when we bumb the
package.json version and push to `main`
This commit is contained in:
Fabien O'Carroll 2024-09-26 15:29:12 +07:00 committed by Fabien 'egg' O'Carroll
parent 9bb1696329
commit 5f637af3cf

View file

@ -999,3 +999,63 @@ jobs:
inputs: '{"version":"canary","environment":"staging","version_extra":"${{ env.branch_name }}"}'
wait-for-completion-timeout: 25m
wait-for-completion-interval: 30s
publish_admin_x_activitypub:
needs: [
job_setup,
job_lint,
job_unit-tests
]
name: Publish @tryghost/admin-x-activitypub
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: '18.12.1'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_setup.outputs.dependency_cache_key }}
- name: Build the package
run: yarn run nx build @tryghost/admin-x-activitypub
- name: Check if version changed
id: version_check
working-directory: apps/admin-x-activitypub
run: |
CURRENT_VERSION=$(cat package.json | jq -r .version)
PUBLISHED_VERSION=$(npm show @tryghost/admin-x-activitypub version || echo "0.0.0")
echo "Current version: $CURRENT_VERSION"
echo "Published version: $PUBLISHED_VERSION"
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: Configure .npmrc
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/admin-x-activitypub
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
- name: Purge jsdelivr cache
uses: gacts/purge-jsdelivr-cache@v1
with:
url: |
https://cdn.jsdelivr.net/npm/@tryghost/admin-x-activitypub@0/dist/admin-x-activitypub.js