Skip to content

Commit

Permalink
APIGOV-25964 - automate the release process (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfeldick authored Oct 11, 2023
1 parent 025d8cb commit 7b421ea
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/create-tag-for-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This action gets triggered by a closed PR on branch named 'APIGOV-UpdateSDK'
name: Create tag for release

on:
pull_request:
types:
- closed

jobs:
if_SDK_update_merged:
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'APIGOV-UpdateSDK')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Bump tag version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
# by default, this action creates a tag with a 'v' prefix, and bumps the patch version.
# See https://github.com/mathieudutour/github-tag-action to customize these rules.
github_token: ${{ secrets.ACTION_ACCESS_TOKEN }}

- name: Show the new tag
run: |
echo "previous tag ${{ steps.tag_version.outputs.previous_tag }}
echo "new tag ${{ steps.tag_version.outputs.new_tag }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
50 changes: 50 additions & 0 deletions .github/workflows/update-sdk-for-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# this action is triggered by selecting the action in the github UI and then clicking "run workflow"
name: Update SDK version for release

on: workflow_dispatch

jobs:
updateAndCreatePR:
env:
GOFLAGS: "-mod=mod"
GOWORK: "off"
defaults:
run:
working-directory: .
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21

- name: Get latest SDK version
run: |
export LATEST_REMOTE_TAG_CMD="git ls-remote --tags --refs --sort='version:refname' REMOTE_REPO | grep -Eo 'v?[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,3}$' | tail -1"
REMOTE_REPO_PATH="https://github.com/Axway/agent-sdk"
CMD=${LATEST_REMOTE_TAG_CMD/"REMOTE_REPO"/${REMOTE_REPO_PATH}}
export SDK_VERSION=$(eval $CMD)
echo "SDK_VERSION=${SDK_VERSION}" >> $GITHUB_ENV
- name: Update SDK version in go.mod
working-directory: .
run: |
echo "SDK_VERSION is ${{ env.SDK_VERSION }}"
make dep-version sdk=v1.1.62
cat discovery/go.mod
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5.0.2
with:
branch: APIGOV-UpdateSDK
commit-message: 'Update to SDK ${{ env.SDK_VERSION }}'
title: 'APIGOV-UpdateSDK - Update to SDK ${{ env.SDK_VERSION }}'
delete-branch: true
reviewers: dfeldick

- name: Enable Pull Request Automerge
run: gh pr merge APIGOV-UpdateSDK --admin --merge --subject "Merge branch APIGOV-UpdateSDK"
env:
GH_TOKEN: ${{ secrets.ACTION_ACCESS_TOKEN }}

0 comments on commit 7b421ea

Please sign in to comment.