summaryrefslogtreecommitdiffstats
path: root/.github/workflows/main.yml
blob: ecbb064232fd1d13f59d9c165aea0cf691beb767 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
on: [push, pull_request]

jobs:
  ci:
    name: CI
    runs-on: ubuntu-latest
    steps:

      - uses: actions/checkout@master
        with:
          fetch-depth: 50

      - name: Install Rust Stable
        run: |
          rustc -vV
          rustup update stable
          rustup default stable
          rustc -vV

      - name: Build the validation tool
        run: cargo build

      - name: Validate the repository contents
        run: cargo run -- check --strict
        env:
          GITHUB_TOKEN: ${{ secrets.github_token }}

      - name: Run rustfmt
        run: cargo fmt -- --check

      - name: Run clippy
        run: cargo clippy -- -Dwarnings

      - name: Build the contents of the static API
        run: |
          cargo run -- static-api build
          echo "team-api.infra.rust-lang.org" > build/CNAME

      - name: Deploy to GitHub Pages
        run: |
          touch build/.nojekyll
          curl -LsSf https://raw.githubusercontent.com/rust-lang/simpleinfra/master/setup-deploy-keys/src/deploy.rs | rustc - -o /tmp/deploy
          (cd build && /tmp/deploy)
        env:
          GITHUB_DEPLOY_KEY: ${{ secrets.GITHUB_DEPLOY_KEY }}
        if: github.ref == 'refs/heads/master'