Skip to content

Deploy book

Deploy book #971

Workflow file for this run

name: Deploy book
on:
push:
pull_request:
schedule:
- cron: '0 6 * * 1' # Every Monday 6 AM UTC
jobs:
build:
name: Deploy book
runs-on: ubuntu-latest
steps:
- name: Download source
uses: actions/checkout@v3
- name: Extract branch name to deploy
id: branch
shell: bash -x {0}
run: |
if [[ ${GITHUB_BASE_REF:-$GITHUB_REF} =~ ^(refs/heads/)?(master|release/[0-9][0-9.]+)$ ]]; then
echo "::set-output name=branch::${BASH_REMATCH[2]#release/}"
fi
- name: Install Crystal
id: crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ steps.branch.outputs.branch }}
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('requirements.txt') }}
restore-keys: pip-
- name: Install dependencies
run: pip install -r requirements.txt
- name: Determine a version for API doc links
shell: bash -x {0}
run: |
if [[ '${{ steps.branch.outputs.branch }}' =~ ^[0-9] ]]; then
echo "CRYSTAL_VERSION=${{ steps.crystal.outputs.crystal }}" >> ${GITHUB_ENV}
fi
- name: Populate sample version of Crystal
run: crystal --version | tee crystal-version.txt
- name: Build book
run: LINT=true make build
- name: Configure AWS Credentials
if: github.event_name == 'push' && steps.branch.outputs.branch != null && github.repository == 'crystal-lang/crystal-book'
uses: aws-actions/configure-aws-credentials@v2
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 book
if: github.event_name == 'push' && steps.branch.outputs.branch != null && github.repository == 'crystal-lang/crystal-book'
run: aws s3 sync ./site s3://crystal-book/reference/${{ steps.branch.outputs.branch }} --delete
lint:
name: Check style issues
runs-on: ubuntu-latest
steps:
- name: Download source
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 14
- name: Install dependencies
run: npm install -g [email protected]
- name: Check Markdown style
run: markdownlint docs