add text compresison for better performance #6
Workflow file for this run
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
# Controls when the action will run. Invokes the workflow on push events but only for the main branch | |
name: Deploy Website to S3 | |
on: | |
pull_request: | |
branches: | |
- main | |
env: | |
AWS_REGION: us-west-1 | |
# Permission can be added at job level or workflow level | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
AssumeRoleAndCallIdentity: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Git clone the repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Node.js (for Vite) | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' # Use the Node.js version your project requires | |
# Step 3: Install dependencies (this installs Vite and other dependencies) | |
- name: Install dependencies | |
run: npm install | |
# Step 4: Build the project with Vite | |
- name: Build project | |
run: npm run build # This command will generate the ./dist folder | |
# Step 5: Configure AWS credentials | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v1.7.0 | |
with: | |
role-to-assume: arn:aws:iam::514531162242:role/GitHubAction-AssumeRoleWithAction | |
role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
aws-region: ${{ env.AWS_REGION }} | |
# Step 6: Verify AWS connection (optional) | |
- name: Sts GetCallerIdentity | |
run: | | |
aws sts get-caller-identity | |
# Step 7: Sync files to S3 (this step will sync only the ./dist folder) | |
- name: Sync files to S3 | |
run: | | |
aws s3 sync ./dist s3://rsgoshen.us --delete |