Skip to content

Release host package #11

Release host package

Release host package #11

Workflow file for this run

name: Release host package
on:
workflow_dispatch:
inputs:
release-level:
description: "Release level"
required: true
type: choice
default: prerelease
options:
- prerelease
- patch
- minor
- major
release-kind:
description: "Release kind"
required: false
type: choice
default: alpha
options:
- alpha
- beta
- rc
- stable
package:
description: "Which package to release"
required: true
type: choice
options:
- python_host
- nodejs_host
- cloudflare_worker_host
jobs:
core:
name: Core WASM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build_core
with:
CARGO_PROFILE: 'release'
CORE_WASM: 'upload'
host-nodejs-prepare:
name: Prepare Node.js Host
needs: [core]
if: ${{ !cancelled() && needs.core.result == 'success' && inputs.package == 'nodejs_host' }}
runs-on: ubuntu-latest
env:
PACKAGE_PATH: packages/nodejs_host
PACKAGE_TAG: nodejs
outputs:
RELEASE_VERSION: ${{ steps.prepare_package.outputs.RELEASE_VERSION }}
RELEASE_LEVEL: ${{ steps.prepare_package.outputs.RELEASE_LEVEL }}
RELEASE_TAG: ${{ steps.prepare_package.outputs.RELEASE_TAG }}
RELEASE_PREID: ${{ steps.prepare_package.outputs.RELEASE_PREID }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/package_prepare
id: prepare_package
with:
RELEASE_LEVEL: ${{ inputs.release-level }}
RELEASE_KIND: ${{ inputs.release-kind }}
PACKAGE_PATH: ${{ env.PACKAGE_PATH }}
- uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: "18"
cache: yarn
cache-dependency-path: ${{ env.PACKAGE_PATH }}/yarn.lock
- uses: actions/download-artifact@v4
with:
name: core-async-wasm
path: ${{ env.PACKAGE_PATH }}/assets
- name: Update version in package.json
working-directory: ${{ env.PACKAGE_PATH }}
run: yarn version --no-git-tag-version --new-version ${{ steps.prepare_package.outputs.RELEASE_VERSION }}
- name: Build
working-directory: ${{ env.PACKAGE_PATH }}
run: |
yarn install --frozen-lockfile
yarn build
- name: Commit package.json, VERSION, CHANGELOG.md and create git tag
working-directory: ${{ env.PACKAGE_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add package.json VERSION CHANGELOG.md
git commit -m "chore: release ${{ env.PACKAGE_PATH }} ${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
git tag "${{ env.PACKAGE_TAG }}-v${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
git push origin
git push origin --tags
- name: Update GitHub release documentation
uses: softprops/action-gh-release@v1
with:
tag_name: "${{ env.PACKAGE_TAG }}-v${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
body: ${{ steps.prepare_package.outputs.CHANGELOG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
host-nodejs-publish:
name: Publish Node.js Host
needs: [core, host-nodejs-prepare]
if: ${{ !cancelled() && needs.host-nodejs-prepare.result == 'success' }}
runs-on: ubuntu-latest
env:
PACKAGE_PATH: packages/nodejs_host
steps:
# Setup
- uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: "18"
cache: yarn
cache-dependency-path: ${{ env.PACKAGE_PATH }}/yarn.lock
# Build
- uses: actions/download-artifact@v4
with:
name: core-async-wasm
path: ${{ env.PACKAGE_PATH }}/assets
- name: Copy LICENSE
run: cp LICENSE ${{ env.PACKAGE_PATH }}/LICENSE
- name: Build
working-directory: ${{ env.PACKAGE_PATH }}
run: |
yarn install --frozen-lockfile
yarn build
# Publish
- name: Publish to NPM registry
working-directory: ${{ env.PACKAGE_PATH }}
env:
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]
if: ${{ !cancelled() && needs.core.result == 'success' && inputs.package == 'cloudflare_worker_host' }}
runs-on: ubuntu-latest
env:
PACKAGE_PATH: packages/cloudflare_worker_host
PACKAGE_TAG: cfw
outputs:
RELEASE_VERSION: ${{ steps.prepare_package.outputs.RELEASE_VERSION }}
RELEASE_LEVEL: ${{ steps.prepare_package.outputs.RELEASE_LEVEL }}
RELEASE_TAG: ${{ steps.prepare_package.outputs.RELEASE_TAG }}
RELEASE_PREID: ${{ steps.prepare_package.outputs.RELEASE_PREID }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/package_prepare
id: prepare_package
with:
RELEASE_LEVEL: ${{ inputs.release-level }}
RELEASE_KIND: ${{ inputs.release-kind }}
PACKAGE_PATH: ${{ env.PACKAGE_PATH }}
- uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: "18"
cache: yarn
cache-dependency-path: ${{ env.PACKAGE_PATH }}/yarn.lock
- uses: actions/download-artifact@v4
with:
name: core-async-wasm
path: ${{ env.PACKAGE_PATH }}/assets
- name: Update version in package.json
working-directory: ${{ env.PACKAGE_PATH }}
run: yarn version --no-git-tag-version --new-version ${{ steps.prepare_package.outputs.RELEASE_VERSION }}
- name: Build
working-directory: ${{ env.PACKAGE_PATH }}
run: |
yarn install --frozen-lockfile
yarn build
- name: Commit package.json, VERSION, CHANGELOG.md and create git tag
working-directory: ${{ env.PACKAGE_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add package.json VERSION CHANGELOG.md
git commit -m "chore: release ${{ env.PACKAGE_PATH }} ${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
git tag "${{ env.PACKAGE_TAG }}-v${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
git push origin
git push origin --tags
- name: Update GitHub release documentation
uses: softprops/action-gh-release@v1
with:
tag_name: "${{ env.PACKAGE_TAG }}-v${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
body: ${{ steps.prepare_package.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
env:
PACKAGE_PATH: packages/cloudflare_worker_host
steps:
# Setup
- uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: "18"
cache: yarn
cache-dependency-path: ${{ env.PACKAGE_PATH }}/yarn.lock
# Build
- uses: actions/download-artifact@v4
with:
name: core-async-wasm
path: ${{ env.PACKAGE_PATH }}/assets
- name: Copy LICENSE
run: cp LICENSE ${{ env.PACKAGE_PATH }}/LICENSE
- name: Build
working-directory: ${{ env.PACKAGE_PATH }}
run: |
yarn install --frozen-lockfile
yarn build
# Publish
- name: Publish to NPM registry
working-directory: ${{ env.PACKAGE_PATH }}
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]
if: ${{ !cancelled() && needs.core.result == 'success' && inputs.package == 'python_host' }}
runs-on: ubuntu-latest
env:
PACKAGE_PATH: packages/python_host
PACKAGE_TAG: python
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/package_prepare
id: prepare_package
with:
RELEASE_LEVEL: ${{ inputs.release-level }}
RELEASE_KIND: ${{ inputs.release-kind }}
PACKAGE_PATH: ${{ env.PACKAGE_PATH }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Python tools
run: python -m pip install build toml-cli
- uses: actions/download-artifact@v4
with:
name: core-wasm
path: ${{ env.PACKAGE_PATH }}/src/one_sdk/assets
- name: Update version in pyproject
working-directory: ${{ env.PACKAGE_PATH }}
run: toml set --toml-path pyproject.toml project.version ${{ steps.prepare_package.outputs.RELEASE_VERSION }}
- name: Build packages/python_host
working-directory: ${{ env.PACKAGE_PATH }}
run: python -m build
- name: Commit pyproject.toml, VERSION, CHANGELOG.md and create git tag
working-directory: ${{ env.PACKAGE_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add pyproject.toml VERSION CHANGELOG.md
git commit -m "chore: release ${{ env.PACKAGE_PATH }} ${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
git tag "${{ env.PACKAGE_TAG }}-v${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
git push origin
git push origin --tags
- name: Update GitHub release documentation
uses: softprops/action-gh-release@v1
with:
tag_name: "${{ env.PACKAGE_TAG }}-v${{ steps.prepare_package.outputs.RELEASE_VERSION }}"
body: ${{ steps.prepare_package.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
host-python-publish:
name: Publish Python Host
needs: [core, host-python-prepare]
if: ${{ !cancelled() && needs.host-python-prepare.result == 'success' }}
runs-on: ubuntu-latest
env:
PACKAGE_PATH: packages/python_host
steps:
# Setup
- uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Python tools
run: python -m pip install build toml-cli
# Build
- uses: actions/download-artifact@v4
with:
name: core-wasm
path: ${{ env.PACKAGE_PATH }}/src/one_sdk/assets
- name: Copy LICENSE
run: cp LICENSE ${{ env.PACKAGE_PATH }}/LICENSE
- name: Build ${{ env.PACKAGE_PATH }}
working-directory: ${{ env.PACKAGE_PATH }}
run: python -m build
# Publish
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ${{ env.PACKAGE_PATH }}/dist
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
trigger_daily:
name: Trigger daily build
needs: [host-nodejs-publish, host-python-publish]
if: ${{ !cancelled() && (needs.host-nodejs-publish.result == 'success' || needs.host-python-publish.result == 'success') }}
runs-on: ubuntu-latest
steps:
- name: Trigger Daily Test
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GH_BOT_PAT }}
repository: superfaceai/superface-daily
event-type: on-demand-test