From 81af1cda746b55fa52561137294f2fcd548b9823 Mon Sep 17 00:00:00 2001 From: Jim Bumgardner Date: Wed, 6 Sep 2023 13:16:02 -0700 Subject: [PATCH] Disabled much of deploy_pr until it is set up. --- .github/workflows/deploy_pr_preview.yml | 132 ++++++++++++------------ 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/.github/workflows/deploy_pr_preview.yml b/.github/workflows/deploy_pr_preview.yml index 150e0204..22ed4cca 100644 --- a/.github/workflows/deploy_pr_preview.yml +++ b/.github/workflows/deploy_pr_preview.yml @@ -1,67 +1,67 @@ -# name: Deploy PR Preview abortion.ca.gov -# on: -# pull_request: -# types: -# - opened -# - synchronize -# - ready_for_review -# - reopened -# jobs: -# build_deploy: -# runs-on: ubuntu-latest -# steps: -# - uses: n1hility/cancel-previous-runs@v2 -# with: -# token: ${{ secrets.GITHUB_TOKEN }} -# - uses: actions/checkout@master -# - name: Use Node.js 16 -# uses: actions/setup-node@v1 -# with: -# node-version: 16 -# - name: Get branch name (merge) -# if: github.event_name != 'pull_request' -# shell: bash -# run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV -# - name: Get branch name (pull request) -# if: github.event_name == 'pull_request' -# shell: bash -# run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV -# - name: Escape branch name for URL -# shell: bash -# run: echo "URLSAFE_BRANCH_NAME=$(echo ${BRANCH_NAME} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|')" >> $GITHUB_ENV -# - name: Report escaped branch name -# shell: bash -# run: echo ${URLSAFE_BRANCH_NAME} -# - name: Build 11ty -# run: | -# mkdir _site -# mkdir _site_dist -# npm install --legacy-peer-deps -# DOMAIN=${URLSAFE_BRANCH_NAME}.pr.abortion.ca.gov npm run build -# npx playwright install -# npm test -# - name: Write robots.txt -# run: | -# echo 'User-agent: *' > _site/robots.txt -# echo 'Disallow: /' >> _site/robots.txt -# - 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: us-west-1 -# - name: Deploy to S3 -# run: aws s3 sync --follow-symlinks --delete ./_site s3://pr.abortion.ca.gov/pr/${URLSAFE_BRANCH_NAME} -# - name: invalidate Cloudfront -# run: aws cloudfront create-invalidation --distribution-id E1TSIDJQ2I1IOH --paths "/*" -# - name: Post URL to PR -# uses: mshick/add-pr-comment@v1 -# with: -# message: | -# Preview site available at [${{ env.URLSAFE_BRANCH_NAME }}.pr.abortion.ca.gov](https://${{ env.URLSAFE_BRANCH_NAME }}.pr.abortion.ca.gov/). +name: Deploy PR Preview abortion.ca.gov +on: + pull_request: + types: + - opened + - synchronize + - ready_for_review + - reopened +jobs: + build_deploy: + runs-on: ubuntu-latest + steps: + - uses: n1hility/cancel-previous-runs@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@master + - name: Use Node.js 16 + uses: actions/setup-node@v1 + with: + node-version: 16 + - name: Get branch name (merge) + if: github.event_name != 'pull_request' + shell: bash + run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + - name: Get branch name (pull request) + if: github.event_name == 'pull_request' + shell: bash + run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV + - name: Escape branch name for URL + shell: bash + run: echo "URLSAFE_BRANCH_NAME=$(echo ${BRANCH_NAME} | sed 's|[^A-Za-z0-9-]|-|g' | sed -E 's|-*([A-Za-z0-9]*.*[A-Za-z0-9]+)-*|\1|')" >> $GITHUB_ENV + - name: Report escaped branch name + shell: bash + run: echo ${URLSAFE_BRANCH_NAME} + # - name: Build 11ty + # run: | + # mkdir _site + # mkdir _site_dist + # npm install --legacy-peer-deps + # DOMAIN=${URLSAFE_BRANCH_NAME}.pr.abortion.ca.gov npm run build + # npx playwright install + # npm test + # - name: Write robots.txt + # run: | + # echo 'User-agent: *' > _site/robots.txt + # echo 'Disallow: /' >> _site/robots.txt + # - 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: us-west-1 + # - name: Deploy to S3 + # run: aws s3 sync --follow-symlinks --delete ./_site s3://pr.abortion.ca.gov/pr/${URLSAFE_BRANCH_NAME} + # - name: invalidate Cloudfront + # run: aws cloudfront create-invalidation --distribution-id E1TSIDJQ2I1IOH --paths "/*" + # - name: Post URL to PR + # uses: mshick/add-pr-comment@v1 + # with: + # message: | + # Preview site available at [${{ env.URLSAFE_BRANCH_NAME }}.pr.abortion.ca.gov](https://${{ env.URLSAFE_BRANCH_NAME }}.pr.abortion.ca.gov/). -# Username: odiandfriends -# Password: OjCcq7JKH8W616upOE0F -# repo-token: ${{ secrets.GITHUB_TOKEN }} -# repo-token-user-login: 'github-actions[bot]' -# allow-repeats: false \ No newline at end of file + # Username: odiandfriends + # Password: OjCcq7JKH8W616upOE0F + # repo-token: ${{ secrets.GITHUB_TOKEN }} + # repo-token-user-login: 'github-actions[bot]' + # allow-repeats: false \ No newline at end of file