Skip to content

Promote to Production #29

Promote to Production

Promote to Production #29

name: Promote to Production
# Only one workflow in a concurrency group may run at a time
concurrency:
group: production-concurrency
cancel-in-progress: true
on:
workflow_dispatch:
jobs:
trigger-github-deployment:
name: Trigger GitHub Deployment
environment: Production
runs-on: ubuntu-latest
steps:
- name: Empty Step
run: echo "Hello World"
get_staging_version:
name: Get version from staging
needs: trigger-github-deployment
outputs:
versionTag: ${{ steps.get_version_tag.outputs.tag }}
runs-on: ubuntu-latest
steps:
- name: Checkout infrastructure
uses: actions/checkout@v3
with:
ref: main
repository: equinor/robotics-infrastructure
ssh-key: ${{ secrets.ROBOTICS_INFRASTRUCTURE_DEPLOY_KEY }}
- name: Get Flotilla version in staging
id: get_version_tag
run: |
TAG_LINE_NUMBER=$(($(grep -n "auroraprodacr.azurecr.io/robotics/flotilla-frontend" k8s_kustomize/overlays/staging/kustomization.yaml | cut --delimiter=":" --fields=1)+1))
VERSION_TAG=$(sed -n "${TAG_LINE_NUMBER}p" k8s_kustomize/overlays/staging/kustomization.yaml | cut --delimiter=":" --fields=2)
echo "tag=$VERSION_TAG" >> "$GITHUB_OUTPUT"
run_migrations:
name: Update database in Production
needs: [get_staging_version, trigger-github-deployment]
uses: ./.github/workflows/runMigrations.yml
with:
PullRequestCheckout: false
Environment: Production
CheckoutRef: ${{ needs.get_staging_version.outputs.versionTag }}
secrets:
ClientId: ${{secrets.CLIENTID}}
ClientSecret: ${{secrets.CLIENTSECRET}}
deploy:
name: Update deployment in Production
needs: [get_staging_version, trigger-github-deployment]
uses: ./.github/workflows/update_aurora_deployment.yml
with:
Environment: production
Tag: ${{ needs.get_staging_version.outputs.versionTag }}
Registry: auroraprodacr.azurecr.io
ImageName: robotics/flotilla
AuthorName: ${{ github.actor }}
secrets:
DeployKey: ${{ secrets.ROBOTICS_INFRASTRUCTURE_DEPLOY_KEY }}