gh-actions-pipelines-app[bot] triggered deploy to prod pipeline #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Release | |
| run-name: ${{ github.actor }} triggered deploy to ${{ github.event.inputs.env }} pipeline | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| env: | |
| description: 'Select environment to deploy' | |
| required: true | |
| default: 'preprod' | |
| type: choice | |
| options: | |
| - preprod | |
| - prod | |
| tag_version: | |
| description: 'Tag version to be deployed' | |
| required: true | |
| default: '' | |
| env: | |
| PROJECT_ID: "${{ secrets.PROJECT_ID }}" | |
| GAR_LOCATION: "${{ secrets.GAR_LOCATION }}" | |
| SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL}}" | |
| SLACK_CHANNEL: "${{ secrets.GITHUBACTIONS_SLACK_CHANNEL }}" | |
| jobs: | |
| deploy: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| environment: ${{ github.event.inputs.env }} | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Google Auth | |
| id: auth | |
| uses: "google-github-actions/auth@v2" | |
| with: | |
| token_format: "access_token" | |
| project_id: "${{ secrets.PROJECT_ID }}" | |
| workload_identity_provider: "${{ secrets.WIF_PROVIDER }}" | |
| service_account: "${{ secrets.WIF_SERVICE_ACCOUNT }}" | |
| - name: Deploy to Cloud Run | |
| uses: actions-hub/gcloud@master | |
| id: deploy | |
| env: | |
| PROJECT_ID: ${{ secrets.PROJECT_ID }} | |
| PROD_PROJECT_ID: ${{ secrets.PROD_PROJECT_ID }} | |
| GAR_LOCATION: ${{ secrets.GAR_LOCATION }} | |
| GAR_NAME: ${{ secrets.GAR_NAME }} | |
| SERVICE_NAME: "${{ secrets.SERVICE_NAME }}" | |
| SERVICE_REGION: "${{ secrets.SERVICE_REGION }}" | |
| with: | |
| args: run services update '${{ env.SERVICE_NAME }}' --image='${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROD_PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ github.event.inputs.tag_version }}:latest --region='${{ env.SERVICE_REGION }}' --project='${{ env.PROJECT_ID }}' | |
| - name: Run Notification | |
| id: runnotificationsent | |
| uses: act10ns/slack@v1 | |
| with: | |
| status: ${{ job.status }} | |
| steps: ${{ toJson(steps) }} | |
| channel: ${{ env.SLACK_CHANNEL }} | |
| message: Deploying tag ${{ github.event.inputs.tag_version }} to ENV ${{ github.event.inputs.env }} ${{ job.status }} | |
| if: always() |