# Publishes this site when you push to main. # # You do not need to change anything in here. It runs on the class server, # copies your files to the web, and your page is live in about a minute. name: Deploy my site on: push: branches: [main] # Lets you re-run a deploy from the web UI without making a commit — # useful when a deploy failed for a reason that wasn't your code. workflow_dispatch: jobs: deploy: runs-on: docker steps: - name: Get my files uses: actions/checkout@v4 - name: Install the AWS tool run: | apt-get update -qq apt-get install -y -qq awscli - name: Check there is a home page run: | if [ ! -f index.html ]; then echo "::error::No index.html in the top folder — the site would 404." echo "Your home page must be called exactly index.html (all lowercase)." exit 1 fi - name: Copy my site to the web env: # These come from this repo's own secrets and are yours alone. They # can only write to your folder — if you point them somewhere else # the copy is refused, by design. AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_DEFAULT_REGION: us-east-1 STUDENT: ${{ github.repository_owner }} run: | if [ -z "$AWS_ACCESS_KEY_ID" ]; then echo "::error::This repo has no deploy key. Ask Mr. W to run provision-deploy-keys.sh." exit 1 fi aws s3 sync . "s3://classproject-dev-student-sites/${STUDENT}/" \ --delete \ --exclude ".git/*" \ --exclude ".forgejo/*" \ --exclude ".vscode/*" \ --exclude "README.md" \ --cache-control "public, max-age=60" \ --no-progress - name: Show my address run: | echo "Live at https://${{ github.repository_owner }}.classproject.dev" echo "(give it up to a minute)"