Infra/Etj2 schema version poll for prod #76221
This file contains 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: "Infra/Etj2 schema version poll for prod" | |
on: | |
schedule: | |
- cron: "*/5 * * * *" | |
jobs: | |
update_applications: | |
if: github.repository != 'tmfg/digitraffic-rail' | |
environment: prod | |
runs-on: ubuntu-22.04 | |
permissions: | |
id-token: write | |
contents: read | |
actions: write | |
steps: | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.S3_ROLE }} | |
role-session-name: gh-actions-deploy-rail-prod | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Get version files from S3 | |
run: | | |
aws s3 sync s3://${{ secrets.EXPORT_BUCKET_NAME }} . | |
shell: bash | |
- name: Set schema versions | |
id: versions | |
run: | | |
test -f etj2_prd.imported && echo "etj2=$(cat etj2_prd.imported|cut -d'_' -f 3)" >> $GITHUB_OUTPUT | |
test -f infra_prd.imported && echo "infra=$(cat infra_prd.imported|cut -d'_' -f 3)" >> $GITHUB_OUTPUT | |
# to reset exit code | |
echo "Versions are set" | |
shell: bash | |
- name: Checkout | |
if: ${{ steps.versions.outputs.infra || steps.versions.outputs.etj2 }} | |
uses: actions/checkout@v4 | |
- name: Update etj2-api | |
if: ${{ steps.versions.outputs.etj2 }} | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
echo updating etj2-api to version ${{ steps.versions.outputs.etj2 }} | |
gh workflow run deploy-from-repo.yml -f env=prod -f application-name=etj2-api -f config-branch=master -f suffix=${{ steps.versions.outputs.etj2 }} | |
aws s3 rm s3://${{ secrets.EXPORT_BUCKET_NAME }}/etj2_prd.imported | |
shell: bash | |
- name: Update infra-api | |
if: ${{ steps.versions.outputs.infra }} | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
echo updating infra-api to version ${{ steps.versions.outputs.infra }} | |
gh workflow run deploy-from-repo.yml -f env=prod -f application-name=infra-api -f config-branch=master -f suffix=${{ steps.versions.outputs.infra }} | |
aws s3 rm s3://${{ secrets.EXPORT_BUCKET_NAME }}/infra_prd.imported | |
shell: bash |