Announcing Crystal+LavinMQ hackathon (#849) #1220
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 | |
on: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: 'Branch, tag or commit SHA1 to build' | |
required: true | |
type: string | |
default: master | |
## cancel ongoing runs if the workflow is triggered | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
name: Build and Deploy | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'crystal-lang' | |
env: | |
O: _site | |
COMPOSE_FILE: "docker-compose.yml:docker-compose.ci.yml" | |
GIT_REF: "${{ (github.event_name == 'workflow_dispatch' && inputs.ref) || github.ref }}" | |
steps: | |
- name: Checkout ${{ env.GIT_REF }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.GIT_REF }} | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/bundle | |
tmp/.htmlproofer | |
key: gem-${{ hashFiles('Gemfile.lock') }} | |
restore-keys: gem- | |
- name: Build website | |
run: | | |
docker compose run --rm web /bin/bash -c "bundle check || bundle install --jobs=3" | |
docker compose run -e O --rm web make build | |
sudo chown -R $(whoami):$(whoami) $O | |
- name: Fetch install.sh | |
run: | | |
make $O/install.sh | |
- name: Configure 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: Sync to S3 | |
run: | | |
aws s3 sync ./$O s3://crystal-website --delete | |
./scripts/set-legacy-url-redirects.bash crystal-website < ./_data/legacy_non_pretty_urls.txt |