React Hook Form (#107) #57
This file contains hidden or 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: Deploy to DEV | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - dev | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: false | |
| env: | |
| AWS_ENV_CODE: dev | |
| jobs: | |
| deploy: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js Environment | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: npm | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Create Environment Configuration | |
| run: | | |
| echo "${{ vars.ENV_DEV }}" > .env | |
| echo "VITE_BUILD_DATE=$(date -u +'%Y-%m-%d')" >> .env | |
| echo "VITE_BUILD_TIME=$(date -u +'%H:%M:%S')" >> .env | |
| echo "VITE_BUILD_TS=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> .env | |
| echo "VITE_BUILD_COMMIT_SHA=${{ github.sha }}" >> .env | |
| echo "VITE_BUILD_ENV_CODE=${{ env.AWS_ENV_CODE }}" >> .env | |
| echo "VITE_BUILD_WORKFLOW_RUNNER=GitHub Actions" >> .env | |
| echo "VITE_BUILD_WORKFLOW_NAME=${{ github.workflow }}" >> .env | |
| echo "VITE_BUILD_WORKFLOW_RUN_NUMBER=${{ github.run_number }}" >> .env | |
| echo "VITE_BUILD_WORKFLOW_RUN_ATTEMPT=${{ github.run_attempt }}" >> .env | |
| - name: Build | |
| run: npm run build | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v6 | |
| with: | |
| aws-region: ${{ vars.AWS_REGION }} | |
| role-to-assume: ${{ vars.AWS_ROLE_ARN_DEV }} | |
| role-session-name: deploy-ionic8-starter-dev | |
| - name: Install infrastructure dependencies | |
| working-directory: ./infrastructure | |
| run: npm ci | |
| - name: Create infrastructure .env file | |
| working-directory: ./infrastructure | |
| run: | | |
| echo "${{ vars.CDK_ENV_DEV }}" > .env | |
| echo "✅ Infrastructure .env file created" | |
| - name: Build infrastructure | |
| working-directory: ./infrastructure | |
| run: npm run build | |
| - name: Bootstrap CDK | |
| working-directory: ./infrastructure | |
| run: | | |
| echo "⚡ Checking if CDK bootstrap is needed..." | |
| # Try to describe the bootstrap stack to see if it exists | |
| if ! aws cloudformation describe-stacks --stack-name CDKToolkit --region ${{ vars.AWS_REGION }} >/dev/null 2>&1; then | |
| echo "🚀 CDK not bootstrapped, bootstrapping now..." | |
| npm run bootstrap | |
| else | |
| echo "✅ CDK already bootstrapped, skipping..." | |
| fi | |
| - name: Synthesize CDK stacks | |
| working-directory: ./infrastructure | |
| run: npm run synth | |
| - name: Deploy CDK stacks | |
| working-directory: ./infrastructure | |
| run: npm run deploy:all -- --require-approval never | |
| - name: Clean up sensitive files | |
| if: always() | |
| working-directory: ./infrastructure | |
| run: | | |
| echo "🧹 Cleaning up sensitive files..." | |
| rm -f .env | |
| rm -rf cdk.out | |
| echo "✅ Sensitive files cleaned up" |