chore(deps): update dependency vitest to v0.34.6 #321
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: Deploy Staging | |
on: | |
pull_request: | |
branches: | |
- main | |
env: | |
PR_NUMBER: ${{github.event.pull_request.number}} | |
AWS_BUCKET_NAME: gatsby-uswds-ts-starter | |
AWS_REGION: us-west-1 | |
jobs: | |
run-ci: | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
name: Lint, test, build and deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: 7 | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Check types | |
run: pnpm type-check | |
- name: Check linting | |
run: pnpm lint | |
- name: Run tests | |
run: pnpm test | |
- name: Check commits messages | |
uses: wagoid/commitlint-github-action@v5 | |
- name: Set DESTINATION_FOLDER for branch | |
run: | | |
echo "DESTINATION_FOLDER=$(echo $PR_NUMBER-$GITHUB_SHA | cut -c 1-11)" >> $GITHUB_ENV | |
- name: Build project | |
run: pnpm build | |
env: | |
SITE_URL: "${{ secrets.STAGE_SITE_URL }}" | |
DEPLOY_PREFIX: "/${{env.DESTINATION_FOLDER}}/" | |
- name: Write AWS_REGION to env context | |
run: | | |
echo "AWS_REGION=$(echo $AWS_REGION)" >> $GITHUB_ENV | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Deploy to AWS | |
run: aws s3 sync ./public/ s3://$AWS_BUCKET_NAME/${{env.DESTINATION_FOLDER}} --acl public-read --delete | |
- name: Write AWS_BUCKET_NAME to env context | |
run: | | |
echo "AWS_BUCKET_NAME=$(echo $AWS_BUCKET_NAME)" >> $GITHUB_ENV | |
- name: Update PR with staging URL | |
uses: mshick/add-pr-comment@v1 | |
with: | |
# Deploy to S3 for the staging URL | |
message: | | |
**🚢 Here is the frontend staging link: 🚢** | |
Find it here: http://${{env.AWS_BUCKET_NAME}}.s3-website.${{env.AWS_REGION}}.amazonaws.com/${{env.DESTINATION_FOLDER}} ! | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
repo-token-user-login: "github-actions[bot]" # The user.login for temporary GitHub tokens | |
allow-repeats: false # This is the default |