Fix/message length calculation (#54) #42
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: Demo deployment workflow | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
format-and-test: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: 'read' | |
actions: 'read' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- uses: nrwl/nx-set-shas@v3 | |
with: | |
main-branch-name: 'develop' | |
workflow-id: 'deploy-demo.yml' | |
- run: npm ci | |
- run: npx nx format:check --exclude=acq,core,discord,discord-bot-ui,discord-bot-ui-e2e,react,sdk,docs.siwt.xyz,siwt.xyz-e2e,smart-contracts | |
- run: npx nx affected --target=test --parallel=3 --exclude=acq,core,discord,discord-bot-ui,discord-bot-ui-e2e,react,sdk,docs.siwt.xyz,siwt.xyz-e2e,smart-contracts | |
- run: npx nx affected --target=build --parallel=3 --exclude=acq,core,discord,discord-bot-ui,discord-bot-ui-e2e,react,sdk,docs.siwt.xyz,siwt.xyz-e2e,smart-contracts | |
deploy: | |
runs-on: ubuntu-latest | |
needs: format-and-test | |
permissions: | |
contents: 'read' | |
actions: 'read' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- uses: nrwl/nx-set-shas@v3 | |
with: | |
main-branch-name: 'develop' | |
workflow-id: 'deploy-demo.yml' | |
- run: npm ci | |
- name: Configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | |
aws-region: 'eu-central-1' | |
- run: npx nx affected --target=build --parallel=3 --exclude=acq,core,discord,discord-bot-ui,discord-bot-ui-e2e,react,sdk,docs.siwt.xyz,siwt.xyz-e2e,smart-contracts | |
- run: npx nx --target=build-server --parallel=3 --exclude=acq,core,discord,discord-bot-ui,discord-bot-ui-e2e,react,sdk,docs.siwt.xyz,siwt.xyz-e2e,smart-contracts | |
- run: npx nx affected --target=export --exclude=acq,core,discord,discord-bot-ui,discord-bot-ui-e2e,react,sdk,docs.siwt.xyz,siwt.xyz-e2e,smart-contracts | |
- name: Setup staging env file | |
if: github.ref == 'refs/heads/develop' | |
env: | |
CERTIFICATE_ARN: ${{ secrets.STAGING_SIWT_XYZ_SSL_CERTIFICATE_ARN }} | |
ENV: staging | |
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.STAGING_SIWT_XYZ_DISTRIBUTION_ID }} | |
run: | | |
touch .env | |
echo SSL_CERTIFICATE_ARN=$CERTIFICATE_ARN >> .env | |
echo ENV=$ENV >> .env | |
cat .env | |
- name: Setup production env file | |
if: github.ref == 'refs/heads/main' | |
env: | |
CERTIFICATE_ARN: ${{ secrets.SIWT_XYZ_SSL_CERTIFICATE_ARN }} | |
ENV: production | |
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.SIWT_XYZ_DISTRIBUTION_ID }} | |
run: | | |
touch .env | |
echo SSL_CERTIFICATE_ARN=$CERTIFICATE_ARN >> .env | |
echo ENV=$ENV >> .env | |
cat .env | |
- name: Deploy | |
run: npx nx affected --target=deploy --exclude=acq,core,discord,discord-bot-ui,discord-bot-ui-e2e,react,sdk,docs.siwt.xyz,siwt.xyz-e2e,smart-contracts --production | |
- name: Invalidate Staging Distribution | |
if: github.ref == 'refs/heads/develop' | |
env: | |
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.STAGING_SIWT_XYZ_DISTRIBUTION_ID }} | |
run: aws cloudfront create-invalidation --distribution-id=$CLOUDFRONT_DISTRIBUTION_ID --paths '/*' | |
- name: Invalidate Production Distribution | |
if: github.ref == 'refs/heads/main' | |
env: | |
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.SIWT_XYZ_DISTRIBUTION_ID }} | |
run: aws cloudfront create-invalidation --distribution-id=$CLOUDFRONT_DISTRIBUTION_ID --paths '/*' |