Skip to content

Release

Release #690

Workflow file for this run

name: Parallel Release
on:
workflow_dispatch:
inputs:
release-version:
required: true
exclude-slow-benchmarks:
description: 'Exclude slow benchmarks'
required: true
type: boolean
default: false
exclude-unstable-benchmarks:
description: 'Exclude unstable benchmarks'
required: true
type: boolean
default: false
exclude-release-only-benchmarks:
description: 'Exclude release benchmarks'
required: true
type: boolean
default: false
jobs:
get-exclude-dirs:
name: Get exclude directories
runs-on: ubuntu-latest
outputs:
exclude-dirs: ${{ steps.get-exclude-dirs.outputs.exclude-dirs }}
steps:
- uses: actions/checkout@v4
- id: get-exclude-dirs
uses: ./.github/actions/get_exclude_dirs
with:
exclude-slow: ${{ github.event.inputs.exclude-slow-benchmarks }}
exclude-unstable: ${{ github.event.inputs.exclude-unstable-benchmarks }}
exclude-release-only: ${{ github.event.inputs.exclude-release-only-benchmarks }}
create-branch-prefix:
uses: ./.github/workflows/create_branch_prefix.yml
with:
prefix: 'update'
version: ${{ inputs.release-version }}
secrets:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
prepare-release:
name: Prepare Release
needs:
- get-exclude-dirs
- create-branch-prefix
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
release-version: ${{ inputs.release-version }}
test-infos: ${{ steps.get-test-infos.outputs.test-infos }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.create-branch-prefix.outputs.base-branch }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }}
- uses: ./.github/actions/setup_node
with:
registry-url: https://registry.npmjs.org
node-auth-token: ${{ secrets.NPM_TOKEN }}
- uses: ./.github/actions/setup_dfx
- run: npm install
- name: Install global dependencies
run: |
AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic
- name: Update version and build templates
run: |
VERSION=${{ inputs.release-version }}
sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" package.json
sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" dfx_extension/extension.json
npm install
AZLE_VERBOSE=true npx azle template
AZLE_VERBOSE=true npx azle template --experimental
- uses: ./.github/actions/commit_and_push
with:
branch-name: ${{ needs.create-branch-prefix.outputs.base-branch }}
commit-message: 'Prepare release ${{ inputs.release-version }}'
gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }}
- name: Publish to npm
run: |
if [[ "${{ inputs.release-version }}" == *"-rc."* ]]; then
npm publish --tag next
else
npm publish
fi
- id: get-test-infos
uses: ./.github/actions/get_test_infos
with:
directories: |
./examples
./tests
exclude-dirs: ${{ needs.get-exclude-dirs.outputs.exclude-dirs }}
update-test-files-for-release-commit:
needs:
- prepare-release
- create-branch-prefix
name: Update ${{ matrix.test.name }} files for release commit
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
test: ${{ fromJson(needs.prepare-release.outputs.test-infos) }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.create-branch-prefix.outputs.base-branch }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }}
- uses: ./.github/actions/setup_node
- uses: ./.github/actions/setup_dfx
- name: Update azle version
run: |
npm install
cd ${{ matrix.test.path }}
sed -E -i "s/(\"azle\": \")(.*)(\")/\1${{ inputs.release-version }}\3/" package.json
npm install
- name: Start dfx with artificial delay 0
working-directory: ${{ matrix.test.path }}
run: dfx start --clean --background --host 127.0.0.1:8000 --artificial-delay 0
- name: Run npm test (continue on error)
working-directory: ${{ matrix.test.path }}
continue-on-error: true
run: npm test
- name: Create branch name
id: create-branch-name
uses: ./.github/actions/create_branch_name
with:
prefix: ${{ needs.create-branch-prefix.outputs.branch-prefix }}
path: ${{ matrix.test.displayPath }}
- uses: ./.github/actions/commit_and_push
with:
branch-name: ${{ steps.create-branch-name.outputs.branch-name }}
commit-message: 'Update test files for ${{ matrix.test.displayPath }}'
gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }}
create-branch: 'true'
squash-branches:
needs:
- prepare-release
- update-test-files-for-release-commit
- create-branch-prefix
uses: ./.github/workflows/squash_branches.yml
with:
base-branch: ${{ needs.create-branch-prefix.outputs.base-branch }}
branch-prefix: ${{ needs.create-branch-prefix.outputs.branch-prefix }}
commit-message: 'Update test files for all tests and examples ${{ inputs.release-version }}'
secrets:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
create-release:
needs:
- prepare-release
- squash-branches
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=${{ inputs.release-version }}
git tag $VERSION
git push origin $VERSION
if [[ "$VERSION" == *"-rc."* ]]; then
gh release create "$VERSION" -t "$VERSION" --prerelease
else
gh release create "$VERSION" -t "$VERSION"
fi
create-pr:
needs:
- prepare-release
- squash-branches
- create-branch-prefix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
run: |
gh pr create \
--base main \
--head ${{ needs.create-branch-prefix.outputs.base-branch }} \
--title "Release ${{ inputs.release-version }}" \
--body "Automated PR for release ${{ inputs.release-version }}"