about summary refs log tree commit diff
path: root/src/tools/clippy/.github/workflows/deploy.yml
blob: f542f9b02c17b3d16903329df6d9d2fb2348462a (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
47
48
49
50
51
name: Deploy

on:
  push:
    branches:
      - master
      - beta
    tags:
      - rust-1.**

env:
  TARGET_BRANCH: 'gh-pages'
  SHA: '${{ github.sha }}'
  SSH_REPO: 'git@github.com:${{ github.repository }}.git'

jobs:
  deploy:
    runs-on: ubuntu-latest
    if: github.repository == 'rust-lang/rust-clippy'

    steps:
    # Setup
    - name: Checkout
      uses: actions/checkout@v2.0.0

    - name: Checkout
      uses: actions/checkout@v2.0.0
      with:
        ref: ${{ env.TARGET_BRANCH }}
        path: 'out'

    # Run
    - name: Set tag name
      if: startswith(github.ref, 'refs/tags/')
      run: |
        TAG=$(basename ${{ github.ref }})
        echo "::set-env name=TAG_NAME::$TAG"
    - name: Set beta to true
      if: github.ref == 'refs/heads/beta'
      run: echo "::set-env name=BETA::true"

    - name: Use scripts and templates from master branch
      run: |
        git fetch --no-tags --prune --depth=1 origin master
        git checkout origin/master -- .github/deploy.sh util/gh-pages/ util/*.py

    - name: Deploy
      run: |
        eval "$(ssh-agent -s)"
        ssh-add - <<< "${{ secrets.DEPLOY_KEY }}"
        bash .github/deploy.sh