diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.yml index 113ef20..fd0cc5e 100644 --- a/.github/workflows/post-merge.yml +++ b/.github/workflows/post-merge.yml @@ -13,14 +13,11 @@ jobs: environment: cstar-d-weu-rtp permissions: - id-token: write # Get OIDC token to authenticate to Azure. - packages: write # Push container imaged to GHCR. contents: write # Create a new release. outputs: new_release_published: ${{ steps.semantic.outputs.new_release_published }} new_version: ${{ steps.semantic.outputs.new_release_version }} - digest: ${{ steps.stable_image.outputs.digest }} steps: # @@ -56,13 +53,33 @@ jobs: @semantic-release/git@10.0.1 # 3e934d45f97fd07a63617c0fc098c9ed3e67d97a dry_run: true + dev_deployment: + needs: post_merge + if: needs.post_merge.outputs.new_release_published == 'true' + runs-on: ubuntu-22.04 + environment: cstar-d-weu-rtp + + permissions: + id-token: write # Get OIDC token to authenticate to Azure. + packages: write # Push container imaged to GHCR. + contents: write # Create a new release. + + outputs: + digest: ${{ steps.stable-image.outputs.digest }} + + steps: + # + # Checkout the source code. + # + - name: Checkout the source code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 + # # RELEASE CANDIDATE - Update of gradle.properties with the RC new version. # - name: RELEASE CANDIDATE - Update of gradle.properties with the new version - if: steps.semantic.outputs.new_release_published == 'true' run: | - sed -i -e "s/version=.*/version=${{ steps.semantic.outputs.new_release_version }}-RC/g" gradle.properties + sed -i -e "s/version=.*/version=${{ needs.post_merge.outputs.new_version }}-RC/g" gradle.properties # todo sonar # @@ -89,7 +106,7 @@ jobs: context: . file: src/main/docker/Dockerfile platforms: linux/amd64 - tags: ghcr.io/${{ github.repository }}:latest, ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }}-RC + tags: ghcr.io/${{ github.repository }}:latest, ghcr.io/${{ github.repository }}:${{ needs.post_merge.outputs.new_version }}-RC secrets: | "gh_token=${{ secrets.GIT_PAT }}" @@ -97,7 +114,6 @@ jobs: # Setup Terraform # - name: Setup Terraform - if: steps.semantic.outputs.new_release_published == 'true' uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 with: terraform_version: 1.9.7 @@ -106,7 +122,6 @@ jobs: # RELEASE CANDIDATE - Update Container App. # - name: RELEASE CANDIDATE - Update Container App - if: steps.semantic.outputs.new_release_published == 'true' shell: bash working-directory: src/main/terraform env: @@ -115,7 +130,7 @@ jobs: ARM_TENANT_ID: "${{ secrets.AZURE_TENANT_ID }}" run: | terraform init -backend-config="env/dev/backend.tfvars" -reconfigure - terraform apply -var-file="env/dev/terraform.tfvars" -var="rtp_activator_image=ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }}-RC@${{ steps.rc-image.outputs.digest }}" -auto-approve -lock-timeout=300s + terraform apply -var-file="env/dev/terraform.tfvars" -var="rtp_activator_image=ghcr.io/${{ github.repository }}:${{ needs.post_merge.outputs.new_version }}-RC@${{ steps.rc-image.outputs.digest }}" -auto-approve -lock-timeout=300s # # # # Install Newman. @@ -141,20 +156,18 @@ jobs: # STABLE - Update of gradle.properties with the new version. # - name: STABLE - Update of gradle.properties with the new version - if: steps.semantic.outputs.new_release_published == 'true' run: | - sed -i -e "s/version=.*/version=${{ steps.semantic.outputs.new_release_version }}/g" gradle.properties + sed -i -e "s/version=.*/version=${{ needs.post_merge.outputs.new_version }}/g" gradle.properties git config user.name "GitHub Workflow" git config user.email "<>" git add gradle.properties - git commit -m "Updated with new version ${{ steps.semantic.outputs.new_release_version }}" + git commit -m "Updated with new version ${{ needs.post_merge.outputs.new_version }}" git push origin main # # Calculation of the new version (again) with tagging + releasing + etc. # - name: Calculation of the new version (w/o dry_run) and put tag - if: steps.semantic.outputs.new_release_published == 'true' uses: cycjimmy/semantic-release-action@b1b432f13acb7768e0c8efdec416d363a57546f2 # 4.1.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -190,7 +203,7 @@ jobs: context: . file: src/main/docker/Dockerfile platforms: linux/amd64 - tags: ghcr.io/${{ github.repository }}:latest, ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }} + tags: ghcr.io/${{ github.repository }}:latest, ghcr.io/${{ github.repository }}:${{ needs.post_merge.outputs.new_version }} secrets: | "gh_token=${{ secrets.GIT_PAT }}" @@ -198,7 +211,6 @@ jobs: # STABLE - Update Container App. # - name: STABLE - Update Container App - if: steps.semantic.outputs.new_release_published == 'true' shell: bash working-directory: src/main/terraform env: @@ -207,11 +219,10 @@ jobs: ARM_TENANT_ID: "${{ secrets.AZURE_TENANT_ID }}" run: | terraform init -backend-config="env/dev/backend.tfvars" -reconfigure - terraform apply -var-file="env/dev/terraform.tfvars" -var="rtp_activator_image=ghcr.io/${{ github.repository }}:${{ steps.semantic.outputs.new_release_version }}@${{ steps.stable_image.outputs.digest }}" -auto-approve -lock-timeout=300s - + terraform apply -var-file="env/dev/terraform.tfvars" -var="rtp_activator_image=ghcr.io/${{ github.repository }}:${{ needs.post_merge.outputs.new_version }}@${{ steps.stable-image.outputs.digest }}" -auto-approve -lock-timeout=300s uat_deployment: - needs: post_merge + needs: [ post_merge, dev_deployment] if: needs.post_merge.outputs.new_release_published == 'true' @@ -249,4 +260,4 @@ jobs: ARM_TENANT_ID: "${{ secrets.AZURE_TENANT_ID }}" run: | terraform init -backend-config="env/uat/backend.tfvars" -reconfigure - terraform apply -var-file="env/uat/terraform.tfvars" -var="rtp_activator_image=ghcr.io/${{ github.repository }}:${{ needs.post_merge.outputs.new_version }}@${{ needs.post_merge.outputs.digest }}" -auto-approve -lock-timeout=300s + terraform apply -var-file="env/uat/terraform.tfvars" -var="rtp_activator_image=ghcr.io/${{ github.repository }}:${{ needs.post_merge.outputs.new_version }}@${{ needs.dev_deployment.outputs.digest }}" -auto-approve -lock-timeout=300s