Skip to content

chore(main): release 1.50.4 (#1867) #80

chore(main): release 1.50.4 (#1867)

chore(main): release 1.50.4 (#1867) #80

# This workflow runs on every push to main and:
# 1. Checks if a new release should be created (via release-please)
# 2. If a release is created:
# 2.1. Checks for backend changes since previous release
# 2.2. If backend changes exist, builds and publishes Docker images with the new version
# 2.3. Triggers staging and yt01 deployment via repository dispatch
name: CI/CD Release Please
on:
push:
branches: [main]
permissions:
contents: write
pull-requests: write
packages: write
jobs:
release-please:
name: Release please
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
version: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
previous_release_sha: ${{ steps.get-previous-release.outputs.sha }}
steps:
- name: Get previous release SHA
id: get-previous-release
run: |
sha=$(gh api repos/${{ github.repository }}/releases/latest --jq '.target_commitish')
echo "sha=${sha}" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.RELEASE_PLEASE_PAT }}
check-for-changes:
name: Check for changes
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created == 'true' }}
uses: ./.github/workflows/workflow-check-for-changes.yml
with:
apps_base_sha: ${{ needs.release-please.outputs.previous_release_sha }}
publish:
name: Build and publish docker images
needs: [release-please, check-for-changes]
if: needs.release-please.outputs.release_created == 'true' && needs.check-for-changes.outputs.hasBackendChanges == 'true'
uses: ./.github/workflows/workflow-publish.yml
secrets:
GCR_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
with:
dockerImageBaseName: ghcr.io/altinn/dialogporten-
version: ${{ needs.release-please.outputs.version }}
notify-release-created:
name: Notify release created
needs: [release-please, publish]
if: ${{ always() && !failure() && !cancelled() && needs.release-please.outputs.release_created == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Notify release created
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.RELEASE_PLEASE_PAT }}
event-type: release_created
client-payload: '{"version": "${{ needs.release-please.outputs.version }}"}'
send-slack-message-on-failure:
name: Send Slack message on failure
needs: [release-please, publish, notify-release-created]
if: ${{ always() && failure() && !cancelled() }}
uses: ./.github/workflows/workflow-send-ci-cd-status-slack-message.yml
with:
environment: release-please
publish_status: ${{ needs.publish.result }}
release_please_status: ${{ needs.release-please.result }}
notify_release_created_status: ${{ needs.notify-release-created.result }}
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID_FOR_CI_CD_STATUS }}