Skip to content

Prepare for release #130

Prepare for release

Prepare for release #130

name: Prepare for release
# This action:
# - Is triggered manually in a workflow dispatch;
# - Inquire the kind of release in a dropdown menu;
# - Use Poetry to bump up the versions;
# - Create a new header for the new version at the changelogs;
# - Check if all sub-projects share the same version number;
# - Create a new branch named prepare-release/<new_version>;
# - Open a draft PR to the main branch, so all the changes above can be reviewed by the team before merging.
on:
workflow_dispatch:
inputs:
bump_rule:
type: choice
description: Release Type
options:
- patch
- minor
- major
- prepatch
- preminor
- premajor
- prerelease
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.5.1
- id: api-package
name: Bump version on the API
working-directory: jobbergate-api
run: |
../release-scripts/prepare-release.sh ${{ github.event.inputs.bump_rule }}
echo "Poetry version is: $(poetry version --short)"
echo "::set-output name=version::$(poetry version --short)"
- id: cli-package
name: Bump version on the CLI
working-directory: jobbergate-cli
run: |
../release-scripts/prepare-release.sh ${{ github.event.inputs.bump_rule }}
echo "Poetry version is: $(poetry version --short)"
echo "::set-output name=version::$(poetry version --short)"
- id: core-package
name: Bump version on the Core
working-directory: jobbergate-core
run: |
../release-scripts/prepare-release.sh ${{ github.event.inputs.bump_rule }}
echo "Poetry version is: $(poetry version --short)"
echo "::set-output name=version::$(poetry version --short)"
- id: agent-package
name: Bump version on the Agent
working-directory: jobbergate-agent
run: |
../release-scripts/prepare-release.sh ${{ github.event.inputs.bump_rule }}
echo "Poetry version is: $(poetry version --short)"
echo "::set-output name=version::$(poetry version --short)"
- id: docs
name: Bump version on the Documentation
working-directory: jobbergate-docs
run: |
../release-scripts/prepare-release.sh ${{ github.event.inputs.bump_rule }}
echo "Poetry version is: $(poetry version --short)"
echo "::set-output name=version::$(poetry version --short)"
- name: Fail if poetry packages version don't match
if: ${{ steps.api-package.outputs.version != steps.agent-package.outputs.version != steps.core-package.outputs.version != steps.cli-package.outputs.version != steps.docs.outputs.version}}
run: echo "Poetry packages version don't match!"
- uses: peter-evans/create-pull-request@v4
name: Create Pull Request
id: cpr
with:
token: ${{ secrets.TOKEN }}
commit-message: "Prepared release ${{ steps.api-package.outputs.version }}"
branch: "prepare-release/${{ steps.api-package.outputs.version }}"
title: "Release ${{ steps.api-package.outputs.version }}"
draft: true
delete-branch: true
body: "Automated changes by [prepare_release](https://github.com/omnivector-solutions/jobbergate/blob/main/.github/workflows/prepare_release.yaml) GitHub action."
- name: Show Pull Request info
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"