-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add Cloudflare Worker (cfw) to release pipeline
- Loading branch information
Showing
1 changed file
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,6 +224,142 @@ jobs: | |
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_BOT_PAT }} | ||
run: yarn publish --verbose --no-git-tag-version --access public --new-version ${{ needs.host-nodejs-prepare.outputs.RELEASE_VERSION }} --tag ${{ needs.host-nodejs-prepare.outputs.RELEASE_TAG }} | ||
|
||
host-cfw-prepare: | ||
name: Prepare Cloudflare worker Host | ||
needs: [core, host-nodejs-prepare] | ||
# when host-python is skipped this job should still run if inputs allow | ||
# so we need to include a status check, then manually ensure core build didn't fail | ||
# (see https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions) | ||
if: ${{ !cancelled() && needs.core.result == 'success' && (inputs.package == 'cloudflare_worker' || inputs.package == 'all') }} | ||
runs-on: ubuntu-latest | ||
outputs: | ||
RELEASE_VERSION: ${{ steps.release-version.outputs.RELEASE_VERSION }} | ||
RELEASE_LEVEL: ${{ steps.release-level.outputs.RELEASE_LEVEL }} | ||
RELEASE_TAG: ${{ steps.release-level.outputs.RELEASE_TAG }} | ||
RELEASE_PREID: ${{ steps.release-level.outputs.RELEASE_PREID }} | ||
steps: | ||
# Setup | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref_name }} | ||
- name: Git configuration | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions release workflow" | ||
- uses: actions/setup-node@v3 | ||
with: | ||
registry-url: https://registry.npmjs.org/ | ||
node-version: "18" | ||
cache: yarn | ||
cache-dependency-path: packages/cloudflare_worker_host/yarn.lock | ||
# Release version | ||
- name: Resolve release level | ||
id: release-level | ||
run: scripts/release-level.sh ${{ inputs.release-level }} ${{ inputs.release-kind }} >>$GITHUB_OUTPUT | ||
- name: Resolve release version | ||
id: release-version | ||
run: scripts/release-version.sh ./packages/cloudflare_worker_host/VERSION ${{ steps.release-level.outputs.RELEASE_LEVEL }} ${{ steps.release-level.outputs.RELEASE_PREID }} >>$GITHUB_OUTPUT | ||
# Update version | ||
- name: Update version in package.json | ||
working-directory: packages/cloudflare_worker_host | ||
run: yarn version --no-git-tag-version --new-version ${{ steps.release-version.outputs.RELEASE_VERSION }} | ||
# Build | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: core-async-wasm | ||
path: packages/cloudflare_worker_host/assets | ||
- name: Copy LICENSE | ||
run: cp LICENSE packages/cloudflare_worker_host/LICENSE | ||
- name: Build | ||
working-directory: packages/cloudflare_worker_host | ||
run: | | ||
yarn install --frozen-lockfile | ||
yarn build | ||
# Changelog | ||
- name: Update changelog | ||
uses: superfaceai/release-changelog-action@v1 | ||
if: ${{ steps.release-level.outputs.RELEASE_TAG == 'latest' }} | ||
with: | ||
path-to-changelog: packages/cloudflare_worker_host/CHANGELOG.md | ||
version: ${{ steps.release-version.outputs.RELEASE_VERSION }} | ||
operation: release | ||
# Commit release changes | ||
- name: Git configuration | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions release workflow" | ||
- name: Commit package.json, VERSION, CHANGELOG.md and create git tag | ||
working-directory: packages/cloudflare_worker_host | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git add package.json VERSION CHANGELOG.md | ||
git commit -m "chore: release packages/cloudflare_worker_host ${{ steps.release-version.outputs.RELEASE_VERSION }}" | ||
git tag "cfw-v${{ steps.release-version.outputs.RELEASE_VERSION }}" | ||
git push origin | ||
git push origin --tags | ||
# Create GitHub Release | ||
- name: Version for Changelog entry | ||
id: get-changelog-version | ||
env: | ||
RELEASE_TAG: ${{ steps.release-level.outputs.RELEASE_TAG }} | ||
VERSION: ${{ steps.release-version.outputs.RELEASE_VERSION }} | ||
run: | | ||
if [ "$RELEASE_TAG" = "latest" ]; then | ||
echo VERSION="$VERSION" | ||
else | ||
echo VERSION="" # refers to unreleased section | ||
fi | ||
- name: Get release version changelog | ||
id: get-changelog | ||
uses: superfaceai/release-changelog-action@v1 | ||
with: | ||
path-to-changelog: packages/cloudflare_worker_host/CHANGELOG.md | ||
version: ${{ steps.get-changelog-version.outputs.VERSION }} | ||
operation: read | ||
- name: Update GitHub release documentation | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: "cfw-v${{ steps.release-version.outputs.RELEASE_VERSION }}" | ||
body: ${{ steps.get-changelog.outputs.changelog }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
host-cfw-publish: | ||
name: Publish Cloudflare worker Host | ||
needs: [core, host-cfw-prepare] | ||
if: ${{ !cancelled() && needs.host-cfw-prepare.result == 'success' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Setup | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref_name }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
registry-url: https://registry.npmjs.org/ | ||
node-version: "18" | ||
cache: yarn | ||
cache-dependency-path: packages/cloudflare_worker_host/yarn.lock | ||
# Build | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: core-async-wasm | ||
path: packages/cloudflare_worker_host/assets | ||
- name: Copy LICENSE | ||
run: cp LICENSE packages/cloudflare_worker_host/LICENSE | ||
- name: Build | ||
working-directory: packages/cloudflare_worker_host | ||
run: | | ||
yarn install --frozen-lockfile | ||
yarn build | ||
# Publish | ||
- name: Publish to NPM registry | ||
working-directory: packages/cloudflare_worker_host | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_BOT_PAT }} | ||
run: yarn publish --verbose --no-git-tag-version --access public --new-version ${{ needs.host-cfw-prepare.outputs.RELEASE_VERSION }} --tag ${{ needs.host-cfw-prepare.outputs.RELEASE_TAG }} | ||
|
||
host-python-prepare: | ||
name: Prepare Python Host | ||
needs: [core] | ||
|