Upgrade AWS deprecated Github Action #14
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: Publish site | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-deploy: | |
name: Build & deploy | |
runs-on: ubuntu-20.04 | |
env: | |
LANG: C.UTF-8 | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Set up NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: yarn install --production --non-interactive --no-progress | |
- name: Disable next.js telemetry | |
run: yarn run next telemetry disable | |
- name: Build the site | |
run: yarn export | |
- name: Install dev dependencies (for testing) | |
run: yarn install --non-interactive --no-progress | |
- name: Start web server | |
working-directory: ./out | |
run: | | |
yarn run http-server -o ./ & | |
sleep 5 && | |
curl http://localhost:8080 -I | |
- name: Check for broken links | |
run: | | |
curl http://localhost:8080 -I && | |
wget -r -l8080 --spider -e robots=off --reject-regex='\/&$' -D localhost http://localhost:8080 -o broken-links.log | |
- name: Upload broken links log as artifact | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: broken-links | |
path: broken-links.log | |
- name: Generate version file | |
run: echo "$GITHUB_SHA (#$GITHUB_RUN_NUMBER)" > out/VERSION | |
- name: Setup AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Deploy the site | |
run: aws s3 sync --acl public-read ./out/ s3://handbook.manas.tech |