Repository navigation
Prepare Release #1
This file contains hidden or 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
| # SPDX-License-Identifier: Apache-2.0 | |
| name: Prepare Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| actions-repo: | |
| description: 'Repository with remote actions' | |
| type: string | |
| default: 'nubificus/vaccel' | |
| actions-ref: | |
| description: 'Revision of remote actions repository' | |
| type: string | |
| default: 'main' | |
| version: | |
| description: 'Version to release (e.g., 0.3.2+core-0.7.0)' | |
| type: string | |
| required: true | |
| component: | |
| description: > | |
| Component to release. Defaults to the current repository name. | |
| type: string | |
| required: false | |
| branch: | |
| description: 'Branch to release' | |
| type: string | |
| required: false | |
| core-component: | |
| description: 'Core component name' | |
| type: string | |
| required: true | |
| core-version: | |
| description: 'Core component version' | |
| type: string | |
| required: true | |
| tracking-issue-url: | |
| description: 'Tracking issue URL' | |
| type: string | |
| required: true | |
| orchestrator-repo: | |
| description: 'Repository orchestrating the release (e.g., owner/repo)' | |
| type: string | |
| required: true | |
| dependencies: | |
| description: > | |
| JSON array of dependencies to update, e.g., | |
| [{"name": "dep1", "version": "0.2.0"}] | |
| type: string | |
| required: true | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| permissions: read-all | |
| jobs: | |
| prepare: | |
| name: Prepare Release | |
| runs-on: base-2204-amd64 | |
| steps: | |
| - name: Parse repository names | |
| id: parse-repos | |
| env: | |
| ACTIONS_REPO: ${{ inputs.actions-repo }} | |
| COMPONENT_REPO: >- | |
| ${{ inputs.component && | |
| format('{0}/{1}', github.repository_owner, inputs.component) || | |
| github.repository }} | |
| ORCHESTRATOR_REPO: ${{ inputs.orchestrator-repo }} | |
| run: | | |
| { | |
| echo "repo-name=$(basename "$GITHUB_REPOSITORY")" | |
| echo "actions-repo-name=$(basename "$ACTIONS_REPO")" | |
| echo "component-repo=${COMPONENT_REPO}" | |
| echo "component-repo-name=$(basename "$COMPONENT_REPO")" | |
| echo "orchestrator-repo-name=$(basename "$ORCHESTRATOR_REPO")" | |
| } >> "$GITHUB_OUTPUT" | |
| shell: bash | |
| - name: Generate initialization vaccel-bot token | |
| id: generate-initial-token | |
| uses: actions/create-github-app-token@v3 | |
| with: | |
| client-id: ${{ vars.VACCEL_BOT_CLIENT_ID }} | |
| private-key: ${{ secrets.VACCEL_BOT_PRIVATE_KEY }} | |
| repositories: | | |
| ${{ steps.parse-repos.outputs.actions-repo-name }} | |
| ${{ steps.parse-repos.outputs.component-repo-name }} | |
| permission-contents: read | |
| - name: Checkout .github directory | |
| uses: actions/checkout@v6 | |
| with: | |
| sparse-checkout: .github | |
| repository: ${{ inputs.actions-repo }} | |
| ref: ${{ inputs.actions-ref }} | |
| token: ${{ steps.generate-initial-token.outputs.token }} | |
| - name: Initialize workspace | |
| uses: ./.github/actions/initialize-workspace | |
| with: | |
| repository: ${{ steps.parse-repos.outputs.component-repo }} | |
| remote-actions-repo: ${{ inputs.actions-repo }} | |
| ref: ${{ inputs.branch || '' }} | |
| fetch-depth: 0 | |
| submodules: 'false' | |
| token: ${{ steps.generate-initial-token.outputs.token }} | |
| - name: Update core build dependency version | |
| env: | |
| CORE_COMPONENT: ${{ inputs.core-component }} | |
| CORE_VERSION: ${{ inputs.core-version }} | |
| run: | | |
| if [[ "$CORE_VERSION" =~ ^[0-9]+\.[0-9]+\.0$ ]]; then | |
| ffi_dep_regex='PKG_MIN_VERSION *= *"[0-9]*\.[0-9]*\.[0-9]*"' | |
| ffi_dep_new="PKG_MIN_VERSION = \"${CORE_VERSION}\"" | |
| sed -i "s/${ffi_dep_regex}/${ffi_dep_new}/" build_ffi.py | |
| setup_dep_regex="requires_external *= *${CORE_COMPONENT} *(>=[0-9]*\.[0-9]*\.[0-9]*)" | |
| setup_dep_new="requires_external = ${CORE_COMPONENT} (>=${CORE_VERSION})" | |
| sed -i "s/${setup_dep_regex}/${setup_dep_new}/" setup.cfg | |
| if ! git diff --quiet build_ffi.py setup.cfg; then | |
| echo "Updated ${CORE_COMPONENT} min version to: ${CORE_VERSION}" | |
| else | |
| echo "Nothing to update" | |
| fi | |
| else | |
| printf "%s version '%s' is a patch update - skipping" \ | |
| "$CORE_COMPONENT" "$CORE_VERSION" | |
| fi | |
| shell: bash | |
| - name: Render pull request | |
| id: render-pr | |
| uses: ./.github/actions/render-template | |
| with: | |
| template: .github/templates/prepare-release-pr.md.j2 | |
| data: | | |
| { | |
| "version": "${{ inputs.version }}", | |
| "tracking_issue_url": "${{ inputs.tracking-issue-url }}", | |
| "subprojects": [] | |
| } | |
| - name: Generate PR vaccel-bot token | |
| id: generate-pr-token | |
| if: always() | |
| uses: actions/create-github-app-token@v3 | |
| with: | |
| client-id: ${{ vars.VACCEL_BOT_CLIENT_ID }} | |
| private-key: ${{ secrets.VACCEL_BOT_PRIVATE_KEY }} | |
| repositories: | | |
| ${{ steps.parse-repos.outputs.component-repo-name }} | |
| ${{ steps.parse-repos.outputs.orchestrator-repo-name }} | |
| permission-contents: write | |
| permission-pull-requests: write | |
| permission-actions: write | |
| - name: Create release PR | |
| if: always() | |
| uses: ./.github/actions/create-release-pr | |
| with: | |
| component: ${{ steps.parse-repos.outputs.component-repo-name }} | |
| version: ${{ inputs.version }} | |
| body: ${{ steps.render-pr.outputs.result }} | |
| orchestrator-repo: ${{ inputs.orchestrator-repo }} | |
| core-version: ${{ inputs.core-version }} | |
| committer-slug: ${{ steps.generate-pr-token.outputs.app-slug }} | |
| result: ${{ job.status }} | |
| token: ${{ steps.generate-pr-token.outputs.token }} |