diff --git a/.github/workflows/build-docker-images.yml b/.github/workflows/build-docker-images.yml index bbfd7be..ae51d7c 100644 --- a/.github/workflows/build-docker-images.yml +++ b/.github/workflows/build-docker-images.yml @@ -10,101 +10,101 @@ jobs: testAgents: uses: ./.github/workflows/run-tests.yml - buildDiscoveryAgentDocker: - needs: testAgents - env: - GOFLAGS: "-mod=mod" - GOWORK: "off" - IMAGE_NAME: webmethods_discovery_agent - ORG_NAME: Axway - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + # buildDiscoveryAgentDocker: + # needs: testAgents + # env: + # GOFLAGS: "-mod=mod" + # GOWORK: "off" + # IMAGE_NAME: webmethods_discovery_agent + # ORG_NAME: Axway + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 - - name: Set outputs - id: vars - run: | - echo "date=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT - echo "tag=${{github.ref_name }}" >> $GITHUB_OUTPUT - echo "sdkversion=$(grep github.com/Axway/agent-sdk go.mod | awk '{print $2}')" >> $GITHUB_OUTPUT - echo "commit=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + # - name: Set outputs + # id: vars + # run: | + # echo "date=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT + # echo "tag=${{github.ref_name }}" >> $GITHUB_OUTPUT + # echo "sdkversion=$(grep github.com/Axway/agent-sdk go.mod | awk '{print $2}')" >> $GITHUB_OUTPUT + # echo "commit=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - flavor: latest=false - images: ghcr.io/${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }} + # - name: Log in to the Container registry + # uses: docker/login-action@v3 + # with: + # registry: ghcr.io + # username: ${{ github.actor }} + # password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: build/discovery.Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - time=${{ steps.vars.outputs.date }} - CGO_ENABLED=0 - version=${{ steps.vars.outputs.tag }} - sdk_version=${{ steps.vars.outputs.sdkversion }} - commit_id=${{ steps.vars.outputs.commit }} + # - name: Extract metadata (tags, labels) for Docker + # id: meta + # uses: docker/metadata-action@v5 + # with: + # flavor: latest=false + # images: ghcr.io/${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }} - buildTraceabilityAgentDocker: - needs: testAgents - env: - GOFLAGS: "-mod=mod" - GOWORK: "off" - IMAGE_NAME: webmethods_traceability_agent - ORG_NAME: Axway - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set outputs - id: vars - run: | - echo "date=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT - echo "tag=${{github.ref_name }}" >> $GITHUB_OUTPUT - echo "sdkversion=$(grep github.com/Axway/agent-sdk go.mod | awk '{print $2}')" >> $GITHUB_OUTPUT - echo "commit=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + # - name: Build and push Docker image + # uses: docker/build-push-action@v5 + # with: + # context: . + # file: build/discovery.Dockerfile + # push: true + # tags: ${{ steps.meta.outputs.tags }} + # labels: ${{ steps.meta.outputs.labels }} + # build-args: | + # time=${{ steps.vars.outputs.date }} + # CGO_ENABLED=0 + # version=${{ steps.vars.outputs.tag }} + # sdk_version=${{ steps.vars.outputs.sdkversion }} + # commit_id=${{ steps.vars.outputs.commit }} + + # buildTraceabilityAgentDocker: + # needs: testAgents + # env: + # GOFLAGS: "-mod=mod" + # GOWORK: "off" + # IMAGE_NAME: webmethods_traceability_agent + # ORG_NAME: Axway + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + + # - name: Set outputs + # id: vars + # run: | + # echo "date=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT + # echo "tag=${{github.ref_name }}" >> $GITHUB_OUTPUT + # echo "sdkversion=$(grep github.com/Axway/agent-sdk go.mod | awk '{print $2}')" >> $GITHUB_OUTPUT + # echo "commit=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT + + # - name: Log in to the Container registry + # uses: docker/login-action@v3 + # with: + # registry: ghcr.io + # username: ${{ github.actor }} + # password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - flavor: latest=false - images: ghcr.io/${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }} + # - name: Extract metadata (tags, labels) for Docker + # id: meta + # uses: docker/metadata-action@v5 + # with: + # flavor: latest=false + # images: ghcr.io/${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }} - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: build/traceability.Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - time=${{ steps.vars.outputs.date }} - CGO_ENABLED=0 - version=${{ steps.vars.outputs.tag }} - sdk_version=${{ steps.vars.outputs.sdkversion }} - commit_id=${{ steps.vars.outputs.commit }} + # - name: Build and push Docker image + # uses: docker/build-push-action@v5 + # with: + # context: . + # file: build/traceability.Dockerfile + # push: true + # tags: ${{ steps.meta.outputs.tags }} + # labels: ${{ steps.meta.outputs.labels }} + # build-args: | + # time=${{ steps.vars.outputs.date }} + # CGO_ENABLED=0 + # version=${{ steps.vars.outputs.tag }} + # sdk_version=${{ steps.vars.outputs.sdkversion }} + # commit_id=${{ steps.vars.outputs.commit }} notifyTeamsChannel: runs-on: ubuntu-latest @@ -115,5 +115,4 @@ jobs: env: TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }} TAG: ${{ github.ref_name }} - run: ./release.sh - \ No newline at end of file + run: ./release.sh ${{ github.event.inputs.promotiontype }} diff --git a/.github/workflows/fully-automated-release.yml b/.github/workflows/fully-automated-release.yml index 7d6c0ad..1b4f6d1 100644 --- a/.github/workflows/fully-automated-release.yml +++ b/.github/workflows/fully-automated-release.yml @@ -1,7 +1,13 @@ # this action is triggered by selecting the action in the github UI and then clicking "run workflow" name: Fully automated release -on: workflow_dispatch +on: + workflow_dispatch: + inputs: + promotiontype: + description: Promotion type (major, minor, patch) + required: true + default: 'patch' jobs: updateAndCreatePR: diff --git a/release.sh b/release.sh index d9aa7f0..d3b6392 100755 --- a/release.sh +++ b/release.sh @@ -1,7 +1,7 @@ #!/bin/bash shopt -s nocasematch -# you can add variables like this to test locally. Just run ./release.sh. Note that to run on MAC, you must install bash 5.x. +# you can add variables like this to test locally. Just run ./release.sh. Note that to run on MAC, you must install bash 5.x. # Then, to run the script you must do: /usr/local/bin/bash ./release.sh # TEAMS_WEBHOOK_URL="foo.bar" # TAG="1.2.3" @@ -17,6 +17,10 @@ check_required_variables() { echo "Validating the required environment variables..." [ -z "${TEAMS_WEBHOOK_URL}" ] && echo "TEAMS_WEBHOOK_URL variable not set" && exit 1 + if [[ "$PROMOTION_TYPE" != "patch" && "$PROMOTION_TYPE" != "minor" && "$PROMOTION_TYPE" != "major" ]]; then + echo "PROMOTION_TYPE variable must be patch, minor, or major" + exit 1 + fi [ -z "${TAG}" ] && echo "TAG variable not set" && exit 1 [ -z "${SDK}" ] && echo "SDK variable not set" && exit 1 @@ -73,8 +77,11 @@ post_to_teams() { main() { # validate required variables get_sdk_version + export PROMOTION_TYPE=$1 check_required_variables + exit -1 + if [ $? -eq 1 ]; then echo "No release info being generated." exit 1 @@ -85,7 +92,7 @@ main() { releaseStats+="- SDK version: ${SDK}\n" echo -e "Full Release Info:\n"${releaseStats} - post_to_teams "${releaseStats}" + # post_to_teams "${releaseStats}" exit 0 }