From 74366c3da58d2a89a77e70a0628be6ba1fd8095c Mon Sep 17 00:00:00 2001 From: juliannguyen4 <109386615+juliannguyen4@users.noreply.github.com> Date: Mon, 6 Feb 2023 11:03:08 -0800 Subject: [PATCH] Add workflow to bump version --- .github/release-drafter.yml | 18 ++++++ .github/workflows/build-wheels.yml | 15 +++++ .github/workflows/pre-release.yml | 93 +++++++++++++++++++++++++++ .github/workflows/release-drafter.yml | 45 +++++++++++++ 4 files changed, 171 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/pre-release.yml create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 000000000..44e9a0745 --- /dev/null +++ b/.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 diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 85623bcef..a907c8c5a 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -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 @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 000000000..2fd315db1 --- /dev/null +++ b/.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 diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 000000000..cfb0bae9f --- /dev/null +++ b/.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 }}