Merge pull request #23 from cultuurnet/III-6427-municipal-mergers-2025 #27
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: CI/CD | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
deploy-test: | |
name: Deploy to testing environment | |
runs-on: ubuntu-latest | |
environment: | |
name: testing | |
url: https://taxonomy-test.uitdatabank.be | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.sha }} | |
- name: Deploy index.html to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --exclude '*' --include 'index.html' --content-type text/html | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'eu-west-1' | |
DEST_DIR: '' | |
- name: Deploy XML to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --content-type application/xml | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'eu-west-1' | |
SOURCE_DIR: 'xml' | |
DEST_DIR: 'api' | |
- name: Deploy JSON to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --content-type application/json | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'eu-west-1' | |
SOURCE_DIR: 'json' | |
DEST_DIR: '' | |
- name: Invalidate CloudFront distribution | |
uses: chetan/invalidate-cloudfront-action@v1.3 | |
env: | |
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION }} | |
PATHS: '/*' | |
AWS_REGION: 'us-east-1' | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
deploy-prod: | |
name: Deploy to production environment | |
needs: [deploy-test] | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
url: https://taxonomy.uitdatabank.be | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.sha }} | |
- name: Deploy index.html to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --exclude '*' --include 'index.html' --content-type text/html | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'eu-west-1' | |
DEST_DIR: '' | |
- name: Deploy XML to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --content-type application/xml | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'eu-west-1' | |
SOURCE_DIR: 'xml' | |
DEST_DIR: 'api' | |
- name: Deploy JSON to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --content-type application/json | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'eu-west-1' | |
SOURCE_DIR: 'json' | |
DEST_DIR: '' | |
- name: Invalidate CloudFront distribution | |
uses: chetan/invalidate-cloudfront-action@v1.3 | |
env: | |
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION }} | |
PATHS: '/*' | |
AWS_REGION: 'us-east-1' | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Slack notification | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_CHANNEL: 'build' | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_ICON_EMOJI: ':octocat:' | |
SLACK_USERNAME: 'Github Actions' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |