-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Create a new action for creating a new release candidate. - It will update the latest draft version on files: setup.py, pyproject.toml, .github_changelog_generator, doc/source/conf.py. - Generate tar and zip distribution. - Upload to the release draft. - Add new action for updating target_commitish to "ref/head/master". - Commit changes on master and push them.
- Loading branch information
Showing
3 changed files
with
118 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: "Update target commitish" | ||
description: Update target commitish from a provided release | ||
inputs: | ||
github_token: | ||
description: Provide github token | ||
required: true | ||
release_id: | ||
description: Provide a valid release id | ||
required: true | ||
target_commitish: | ||
description: Provide the new target commitish | ||
required: true | ||
tag_name: | ||
description: Provide the tag name | ||
required: true | ||
|
||
runs: | ||
using: "composite" # This is mandatory if we want to share the action between workflows. | ||
steps: | ||
- name: 'Update target commitish ${{ inputs.target_commitish }}' | ||
shell: bash | ||
run: | | ||
gh api repos/$REPOSITORY/releases/$RELEASE_ID \ | ||
--method PATCH \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-f target_commitish="$TARGET_COMMITISH" \ | ||
-f tag_name="$TAG_NAME" | ||
env: | ||
GH_TOKEN: ${{ inputs.github_token }} | ||
REPOSITORY: ${{ github.repository }} | ||
RELEASE_ID: ${{ inputs.release_id }} | ||
TARGET_COMMITISH: ${{ inputs.target_commitish }} | ||
TAG_NAME: ${{ inputs.tag_name }} | ||
|
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Prepare release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
prepare-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: "Get latest release draft" | ||
uses: cardinalby/git-get-release-action@v1 | ||
id: latest_prerelease | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
latest: true | ||
draft: true | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install twine | ||
pip install coverage | ||
pip install -U pytest | ||
pip install poetry | ||
- name: Run unit tests | ||
run: | | ||
coverage run -m pytest | ||
coverage xml | ||
- name: Bump version on all needed files | ||
run: | | ||
./scripts/update-release.py -v ${{ steps.latest_prerelease.outputs.tag_name }} | ||
- name: "✏️ Generate release changelog" | ||
uses: heinrichreimer/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Check commit has been updated | ||
run: | | ||
git diff | ||
- name: Build package | ||
run: python setup.py sdist --formats=gztar,zip | ||
|
||
- name: Upload binaries to release | ||
uses: xresloader/upload-to-github-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
file: ./dist/* | ||
draft: true | ||
release_id: ${{ steps.latest_prerelease.outputs.id }} | ||
|
||
- name: 'Bump version to ${{ steps.latest_prerelease.outputs.tag_name }}' | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "github-actions[bot]" | ||
git commit -m "Bump version to ${{ steps.latest_prerelease.outputs.tag_name }}" -a | ||
- name: Push changes | ||
uses: ad-m/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.ref }} | ||
|
||
- name: Update target commitish and publish release | ||
uses: './.github/actions/update-target-commitish' | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
release_id: ${{ steps.latest_prerelease.outputs.id }} | ||
target_commitish: "refs/heads/master" | ||
tag_name: ${{ steps.latest_prerelease.outputs.tag_name }} |
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