From bada0d01a17a8fc66041280416203220f53c1b91 Mon Sep 17 00:00:00 2001 From: dfeldick Date: Thu, 12 Oct 2023 12:52:11 -0700 Subject: [PATCH] APIGOV-25964 - test new release actions --- .github/workflows/create-tag-for-release.yml | 33 +++++++++++++ .github/workflows/update-sdk-for-release.yml | 49 +++++++++++++++++++ .../workflows/webmethods-agents-release.yml | 20 ++++---- 3 files changed, 92 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/create-tag-for-release.yml create mode 100644 .github/workflows/update-sdk-for-release.yml diff --git a/.github/workflows/create-tag-for-release.yml b/.github/workflows/create-tag-for-release.yml new file mode 100644 index 0000000..6266f54 --- /dev/null +++ b/.github/workflows/create-tag-for-release.yml @@ -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 }} diff --git a/.github/workflows/update-sdk-for-release.yml b/.github/workflows/update-sdk-for-release.yml new file mode 100644 index 0000000..30bf258 --- /dev/null +++ b/.github/workflows/update-sdk-for-release.yml @@ -0,0 +1,49 @@ +# 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.61 + + - 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 }} diff --git a/.github/workflows/webmethods-agents-release.yml b/.github/workflows/webmethods-agents-release.yml index 967cf03..b26dd78 100644 --- a/.github/workflows/webmethods-agents-release.yml +++ b/.github/workflows/webmethods-agents-release.yml @@ -84,14 +84,14 @@ jobs: overwrite: true body: "webMethods Traceability Agent YAML - ${{ github.ref }}" - notifyTeamsChannel: - needs: [buildDiscoveryAgent, buildTraceabilityAgent] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 + # notifyTeamsChannel: + # needs: [buildDiscoveryAgent, buildTraceabilityAgent] + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 - - name: Notify Teams channel - env: - TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }} - TAG: ${{ github.ref_name }} - run: ./release.sh + # - name: Notify Teams channel + # env: + # TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }} + # TAG: ${{ github.ref_name }} + # run: ./release.sh