Skip to content

Commit

Permalink
APIGOV-dale (#576)
Browse files Browse the repository at this point in the history
* APIGOV-dale - test release

* APIGOV-dale - test

* test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - t

* APIGOV-dale - t

* APIGOV-dale - t

* APIGOV-dale - t

* APIGOV-dale - t

* APIGOV-dale - t

* APIGOV-dale - t

* APIGOV-dale - t

* APIGOV-dale - t

* APIGOV-dale - t

* APIGOV-dale - s

* t

* APIGOV-dale - s

* APIGOV-dale - s

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - tets

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale -

* APIGOV-dale - test

* APIGOV-dale - trdt

* APIGOV-dale - test

* APIGOV-dale - full test

* APIGOV-dale - full test

* APIGOV-dale - full est

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - tets

* APIGOV-dale - sss

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - test

* APIGOV-dale - a

* APIGOV-dale - test

* APIGOV-dale - a

* APIGOV-dale - b

* APIGOV-dale - c

* APIGOV-dale - final cleanup
  • Loading branch information
dfeldick authored Oct 18, 2022
1 parent 0ace45d commit 253ff84
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 48 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,33 @@ jobs:
working-directory: .
steps:
- name: Checkout main
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: main
- name: Set version variables
id: vars
run: |
# The full GITHUB_REF should look like: refs/tags/vn.n.n
echo "GITHUB_REF: ${GITHUB_REF}"
# this mess parses GITHUB_REF into its major/minor/patch parts
MAJOR_VER=$(echo ${GITHUB_REF#*v} | cut -d. -f1)
MINOR_VER=$(echo ${GITHUB_REF#*v} | cut -d. -f2)
PATCH_VER=$(echo ${GITHUB_REF#*v} | cut -d. -f3)
declare -i PATCH_VER
PATCH_VER+=1
echo ::set-output name=next_ver::${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}
- name: Update version file
working-directory: ./build/scripts
# This passes vn.n.n to the shellscript. The full GITHUB_REF is refs/tags/vn.n.n
# This passes vn.n.n to the shellscript.
run: |
./promote.sh ${GITHUB_REF}
./promote.sh ${{ steps.vars.outputs.next_ver }}
- name: Create pull request
uses: peter-evans/create-pull-request@v4
with:
branch: APIGOV-updateversion
commit-message: INT - update to new release ${GITHUB_REF_NAME}
title: INT - update to new release ${GITHUB_REF_NAME}
commit-message: INT - update to new release ${{ steps.vars.outputs.next_ver }}
title: INT - update to new release ${{ steps.vars.outputs.next_ver }}
base: main
delete-branch: true

Expand Down
46 changes: 3 additions & 43 deletions build/scripts/promote.sh
Original file line number Diff line number Diff line change
@@ -1,64 +1,28 @@
#!/bin/bash
check_required_param() {
echo $1
if [ -z $1 ]; then
return 1
fi

pat='v[0-9]+\.[0-9]+\.[0-9]+'
# version must be of the form: x.y.z
pat='[0-9]+\.[0-9]+\.[0-9]+'
if [[ $1 =~ $pat ]]; then
return 0
fi
return 1
}

set_version_variables() {
# remove refs/tags/v
incoming_version=$1
version="${incoming_version:11}"

let MAJOR_VERSION=$(echo $version | cut -d. -f1)
let MINOR_VERSION=$(echo $version | cut -d. -f2)
let PATCH_VERSION=$(echo $version | cut -d. -f3)
let NEW_PATCH_VERSION=($PATCH_VERSION+1)

# right now, this only does patch versioning.
export NEW_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${NEW_PATCH_VERSION}"
export NEW_VERSION=$1
export BASE_DIR=$(realpath $(dirname $0)/../..)
export MSG="update to new release ${NEW_VERSION}"
}

checkout_main() {
# need these in order to commit
git config --global user.name "Gitlab action"
git config --global user.email "[email protected]"
# git fetch
# git checkout main
}

update_version_file() {
echo "Updating version file to version ${NEW_VERSION}"
echo ${NEW_VERSION} > ${BASE_DIR}/version
}

commit_promotion() {
# put this back when we can figure out how to push directly to github sdk, which is protected
# maybe define a user that can push and go git config --locak(global) user
# maybe this? https://github.com/marketplace/actions/add-commit or this https://github.com/peter-evans/create-pull-request
# echo "Committing the new promoted version to main"
# cd ${BASE_DIR}
# git add version
# git commit -m "INT - ${MSG}"
# git push --force origin main

echo "Until the script can be fixed, you must manually do the next steps"
echo " 1) create a new SDK branch"
echo " 2) update the version file by adding 1 to the last digit"
echo " 3) commit the branch with the following message: 'INT - ${MSG}'"
echo " 4) create a pull request on github and await approval"
echo " 5) merge the branch into main"
}

main() {
check_required_param $1
if [ $? -eq 1 ]; then
Expand All @@ -67,13 +31,9 @@ main() {
exit
fi

# checkout_main

set_version_variables $1

update_version_file

commit_promotion
}

main $@

0 comments on commit 253ff84

Please sign in to comment.