Skip to content

Commit

Permalink
Add workflow to bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannguyen4 committed Jul 19, 2023
1 parent e16d9bd commit 74366c3
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/release-drafter.yml
@@ -0,0 +1,18 @@
categories:
- title: Breaking Changes
labels:
- 'breaking-change'
- title: New Features
labels:
- 'new-feature'
- title: Improvements
labels:
- 'improvement'
- title: Bug Fixes
labels:
- 'bug-fix'
change-template: '- $TITLE (#$NUMBER)'
template: |
See [Incompatible API Changes](https://developer.aerospike.com/client/python/incompatible) for details.
$CHANGES
15 changes: 15 additions & 0 deletions .github/workflows/build-wheels.yml
Expand Up @@ -8,9 +8,14 @@ on:
type: boolean
required: true
default: false
skip-updating-version:
type: boolean
required: false
default: false

jobs:
update-version:
if: ${{ inputs.skip-updating-version == false }}
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
Expand Down Expand Up @@ -44,6 +49,8 @@ jobs:
name: Build and install sdist
runs-on: ubuntu-latest
needs: update-version
if: |
always() && (needs.update-version.result == 'success' || needs.update-version.result == 'skipped')
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -108,6 +115,8 @@ jobs:
manylinux_arm64:
runs-on: ubuntu-latest
needs: update-version
if: |
always() && (needs.update-version.result == 'success' || needs.update-version.result == 'skipped')
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -169,6 +178,8 @@ jobs:
manylinux_x86_64:
runs-on: ubuntu-latest
needs: update-version
if: |
always() && (needs.update-version.result == 'success' || needs.update-version.result == 'skipped')
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -359,6 +370,8 @@ jobs:

macOS-x86:
needs: update-version
if: |
always() && (needs.update-version.result == 'success' || needs.update-version.result == 'skipped')
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -407,6 +420,8 @@ jobs:
macOS-m1:
runs-on: [self-hosted, macOS, ARM64]
needs: update-version
if: |
always() && (needs.update-version.result == 'success' || needs.update-version.result == 'skipped')
strategy:
fail-fast: false
matrix:
Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/pre-release.yml
@@ -0,0 +1,93 @@
name: Prepare for release

on:
workflow_dispatch:
inputs:
use-server-rc:
type: boolean
required: true
default: false

jobs:
bump-version:
outputs:
new-version: ${{ steps.bump-version.outputs.new_version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v3
with:
python-version: "3.9"

- name: Get new version and build number
run: |
pip install python-semantic-release
latest_tag=$(cat VERSION)
echo "Bumping off of latest tag $latest_tag"
new_tag=$(pysemver nextver $latest_tag patch)
echo "NEW_TAG=$new_tag" >> $GITHUB_ENV
echo "The new tag for this build is $new_tag"
# TODO: Create a reusable workflow for this
- name: Update version
run: |
sed -i "s/const char version\[] = \".*\";/const char version\[] = \"${{ env.NEW_TAG }}\";/" src/main/aerospike.c
echo -e "${{ env.NEW_TAG }}" > VERSION
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: Bump version to ${{ env.NEW_TAG }}
branch: bump-to-${{ env.NEW_TAG }}
base: stage
add-paths: VERSION, src/main/aerospike.c
delete-branch: true
title: Bump version to ${{ env.NEW_TAG }}

- name: Build wheels for this release
uses: benc-uk/workflow-dispatch@v1
with:
workflow: build-wheels.yml
inputs: '{ "use-server-rc": ${{ inputs.use-server-rc }}, "skip-updating-version": true }'

- name: Run valgrind for this release
uses: benc-uk/workflow-dispatch@v1
with:
workflow: valgrind.yml
inputs: '{ "use-server-rc": ${{ inputs.use-server-rc }} }'

# - name: Create release notes
# uses: release-drafter/release-drafter@v5
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Create draft release in Github
# uses: softprops/action-gh-release@v1
# with:
# draft: true

# - name: Login to Jira
# uses: atlassian/gajira-login@master
# env:
# JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
# JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
# JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
# - uses: atlassian/gajira-create@v3
# with:
# project: DOCS
# issuetype: Task
# summary: Python client ${{ env.NEW_VERSION }} release notes

# - name: Checkout docs.aerospike.com repo
# uses: actions/checkout@v3
# with:
# repository: ${{ secrets.AEROSPIKE_DOCS_REPO }}
# path: docs.aerospike.com
# - name: Create pull request for docs.aerospike.com
# uses: peter-evans/create-pull-request@v4
# with:
# title: Python client ${{ env.NEW_VERSION }} release notes
# branch: ${{ env.BRANCH_NAME }}
# commit-message: Bump version to ${{ env.NEW_VERSION }}
# delete-branch: true
45 changes: 45 additions & 0 deletions .github/workflows/release-drafter.yml
@@ -0,0 +1,45 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- stage
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [
opened,
reopened,
synchronize
]
# pull_request_target event is required for autolabeler to support PRs from forks
# pull_request_target:
# types: [opened, reopened, synchronize]

permissions:
contents: read

jobs:
update_release_draft:
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: read
runs-on: ubuntu-latest
steps:
# (Optional) GitHub Enterprise requires GHE_HOST variable set
#- name: Set GHE_HOST
# run: |
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV

# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 74366c3

Please sign in to comment.