From 6901010581894181afc2dc70a63623ea13fe6a03 Mon Sep 17 00:00:00 2001 From: dfeldick Date: Fri, 7 Jun 2024 10:32:31 -0700 Subject: [PATCH] APIGOV-28015 - add workflow action for nightly testing --- .github/workflows/create-tag-for-release.yml | 10 ++--- .github/workflows/fully-automated-release.yml | 6 +-- .github/workflows/update-gomod-for-tests.yml | 45 +++++++++++++++++++ 3 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/update-gomod-for-tests.yml diff --git a/.github/workflows/create-tag-for-release.yml b/.github/workflows/create-tag-for-release.yml index 0292747..88c1b63 100644 --- a/.github/workflows/create-tag-for-release.yml +++ b/.github/workflows/create-tag-for-release.yml @@ -5,11 +5,11 @@ on: pull_request: types: - closed - + jobs: - # only run this job if the merge name is "APIGOV-UpdateSDK", which comes from the automated release + # only run this job if the merge name is "APIGOV-UpdateSDKForRelease", which comes from the automated release if_SDK_update_merged: - if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'APIGOV-UpdateSDK') + if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'APIGOV-UpdateSDKForRelease') runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -20,12 +20,12 @@ jobs: # 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: diff --git a/.github/workflows/fully-automated-release.yml b/.github/workflows/fully-automated-release.yml index da51666..7d6c0ad 100644 --- a/.github/workflows/fully-automated-release.yml +++ b/.github/workflows/fully-automated-release.yml @@ -37,13 +37,13 @@ jobs: id: cpr uses: peter-evans/create-pull-request@v6 with: - branch: APIGOV-UpdateSDK + branch: APIGOV-UpdateSDKForRelease commit-message: 'Update to SDK ${{ env.SDK_VERSION }}' - title: 'APIGOV-UpdateSDK - Update to SDK ${{ env.SDK_VERSION }}' + title: 'APIGOV-UpdateSDKForRelease - 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" + run: gh pr merge APIGOV-UpdateSDKForRelease --admin --merge --subject "Merge branch APIGOV-UpdateSDKForRelease" env: GH_TOKEN: ${{ secrets.ACTION_ACCESS_TOKEN }} diff --git a/.github/workflows/update-gomod-for-tests.yml b/.github/workflows/update-gomod-for-tests.yml new file mode 100644 index 0000000..5223ac1 --- /dev/null +++ b/.github/workflows/update-gomod-for-tests.yml @@ -0,0 +1,45 @@ +name: Update go.mod for testing + +on: + schedule: + - cron: "0 4 * * *" # time is in UTC + +jobs: + updateAndCreatePR: + env: + GOFLAGS: "-mod=mod" + GOWORK: "off" + defaults: + run: + working-directory: . + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.21 + + - name: Update SDK version in go.mod + working-directory: . + run: | + make dep-version sdk=main + git config --global user.email builder-lphxmjtnt11@axway.com + git config --global user.name builder-lphxmjtnt11 + git commit --allow-empty -m "Updating SDK in go.mod" + + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v6 + with: + branch: APIGOV-UpdateSDKForTesting + commit-message: 'Update to SDK for testing' + title: 'APIGOV-UpdateSDKForTesting - Update SDK for testing' + delete-branch: true + reviewers: dfeldick + + - name: Enable Pull Request Automerge + run: gh pr merge APIGOV-UpdateSDKForTesting --admin --merge --subject "Merge branch APIGOV-UpdateSDKForTesting" + env: + GH_TOKEN: ${{ secrets.ACTION_ACCESS_TOKEN }}