Infra/Etj2 schema version poll for beta #62956
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 beta" | |
on: | |
schedule: | |
- cron: "*/5 * * * *" | |
jobs: | |
update_applications: | |
if: github.repository != 'tmfg/digitraffic-rail' | |
environment: beta | |
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-beta | |
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_beta.imported && echo "etj2=$(cat etj2_beta.imported|cut -d'_' -f 3)" >> $GITHUB_OUTPUT | |
test -f infra_beta.imported && echo "infra=$(cat infra_beta.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=beta -f application-name=etj2-api -f config-branch=master -f suffix=${{ steps.versions.outputs.etj2 }} | |
aws s3 rm s3://${{ secrets.EXPORT_BUCKET_NAME }}/etj2_beta.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=beta -f application-name=infra-api -f config-branch=master -f suffix=${{ steps.versions.outputs.infra }} | |
aws s3 rm s3://${{ secrets.EXPORT_BUCKET_NAME }}/infra_beta.imported | |
shell: bash |