Skip to content

Create release 298.0.0 #32

Create release 298.0.0

Create release 298.0.0 #32

name: "0 [on_dispatch/CD] Create release"
run-name: "Create release ${{ inputs.releaseNumber }}.0.0"
on:
workflow_dispatch:
inputs:
commitHash:
description: "Hash du commit à déployer (ex: cadd172232c80206107e2f0122542adf19fb42af)"
required: true
type: string
releaseNumber:
description: "Numéro de l'itération (ex: 199)"
required: true
type: string
permissions: write-all
jobs:
build-and-tag-version:
name: "Build and tag version"
uses: ./.github/workflows/dev_on_workflow_build_and_tag.yml
secrets:
GCP_EHP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
GCP_EHP_SERVICE_ACCOUNT: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
with:
base_ref: ${{ github.event.inputs.commitHash }}
tag_number: ${{ github.event.inputs.releaseNumber }}.0.0
create-pro-staging-release:
name: "Pro staging"
needs: build-and-tag-version
uses: ./.github/workflows/dev_on_workflow_deploy_pro_pr_version_generic.yml
secrets:
GCP_EHP_SERVICE_ACCOUNT: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
GCP_EHP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
with:
ENV: staging
CHANNEL: "${{ github.event.inputs.releaseNumber }}.0.0"
EXPIRES: "30d"
PUSH_RELEASE_TO_SENTRY: true
REF: v${{ github.event.inputs.releaseNumber }}.0.0
CACHE_BUCKET_NAME: "passculture-infra-prod-github-runner-cache"
create-pro-integration-release:
name: "Pro integration"
needs: build-and-tag-version
uses: ./.github/workflows/dev_on_workflow_deploy_pro_pr_version_generic.yml
secrets:
GCP_EHP_SERVICE_ACCOUNT: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
GCP_EHP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
with:
ENV: integration
CHANNEL: "${{ github.event.inputs.releaseNumber }}.0.0"
EXPIRES: "30d"
REF: v${{ github.event.inputs.releaseNumber }}.0.0
CACHE_BUCKET_NAME: "passculture-infra-prod-github-runner-cache"
create-pro-production-release:
name: "Pro production"
needs: build-and-tag-version
uses: ./.github/workflows/dev_on_workflow_deploy_pro_pr_version_generic.yml
secrets:
GCP_EHP_SERVICE_ACCOUNT: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
GCP_EHP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
with:
ENV: production
CHANNEL: "${{ github.event.inputs.releaseNumber }}.0.0"
EXPIRES: "30d"
REF: v${{ github.event.inputs.releaseNumber }}.0.0
PUSH_RELEASE_TO_SENTRY: true
CACHE_BUCKET_NAME: "passculture-infra-prod-github-runner-cache"
create-maintenance-branch:
name: "Create maintenance branch"
needs:
- build-and-tag-version
- create-pro-production-release
- create-pro-staging-release
- create-pro-integration-release
runs-on: ubuntu-latest
env:
MAINTENANCE_BRANCH: maint/v${{ github.event.inputs.releaseNumber }}
steps:
- name: "Checkout new tag"
uses: actions/[email protected]
with:
ref: v${{ github.event.inputs.releaseNumber }}.0.0
- name: "Create maintenance branch"
run: |
git checkout -b "$MAINTENANCE_BRANCH"
git push origin "$MAINTENANCE_BRANCH"
slack-notification:
runs-on: ubuntu-latest
needs:
- build-and-tag-version
- create-pro-production-release
- create-pro-staging-release
- create-pro-integration-release
if: always()
env:
TAG_NAME: v${{ github.event.inputs.releaseNumber }}.0.0
steps:
- uses: technote-space/workflow-conclusion-action@v3
- name: "Authentification to Google"
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: ${{ secrets.GCP_EHP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_EHP_SERVICE_ACCOUNT }}
- name: "Get Secret"
id: 'secrets'
uses: 'google-github-actions/get-secretmanager-secrets@v2'
with:
secrets: |-
SLACK_BOT_TOKEN:passculture-metier-ehp/passculture-ci-slack-bot-token
- name: "Slack output"
id: "slack-text"
run: |
if [ "${{ env.WORKFLOW_CONCLUSION }}" == "success" ]; then
echo text="La pose du tag *${{ env.TAG_NAME }}* a réussi. Vous pouvez maintenant le <https://github.com/pass-culture/pass-culture-main/actions/workflows/dev_on_dispatch_release_deploy.yml|déployer> :rocket:" | tee -a $GITHUB_OUTPUT
elif [ "${{ env.WORKFLOW_CONCLUSION }}" == "cancelled" ]; then
echo text="La pose du tag a été annulée. Détails sur <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Github>" | tee -a $GITHUB_OUTPUT
else
echo text="La pose du tag *${{ env.TAG_NAME }}* a échoué :x: Détails sur <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Github>" | tee -a $GITHUB_OUTPUT
fi
- name: "Post on #shérif"
if: always()
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }}
with:
channel-id: CU0SQ8Y58
payload: |
{
"attachments": [
{
"color": "${{ fromJSON('["#36a64f", "#A30002"]')[env.WORKFLOW_CONCLUSION == 'failure'] }}",
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.com/${{github.actor}}.png",
"alt_text": "${{github.actor}}"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{github.actor}}|*${{github.actor}}*>"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ steps.slack-text.outputs.text }}"
}
}
]
}
]
}