rust/.github/workflows/deploy.yml

65 lines
1.6 KiB
YAML
Raw Normal View History

2020-01-22 20:00:31 +00:00
name: Deploy
on:
push:
branches:
- master
2020-03-25 19:01:11 +00:00
- beta
tags:
- rust-1.**
2020-01-22 20:00:31 +00:00
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'
2020-01-22 20:00:31 +00:00
steps:
2020-02-07 21:24:41 +00:00
# Setup
2020-01-22 20:00:31 +00:00
- name: Checkout
uses: actions/checkout@v2.3.3
2020-02-07 21:24:41 +00:00
2020-01-22 20:00:31 +00:00
- name: Checkout
uses: actions/checkout@v2.3.3
2020-01-22 20:00:31 +00:00
with:
ref: ${{ env.TARGET_BRANCH }}
path: 'out'
2020-02-07 21:24:41 +00:00
# Run
- name: Set tag name
if: startswith(github.ref, 'refs/tags/')
run: |
TAG=$(basename ${{ github.ref }})
echo "TAG_NAME=$TAG" >> $GITHUB_ENV
2020-03-25 19:01:11 +00:00
- name: Set beta to true
if: github.ref == 'refs/heads/beta'
run: echo "BETA=true" >> $GITHUB_ENV
# We need to check out all files that (transitively) depend on the
# structure of the gh-pages branch, so that we're able to change that
# structure without breaking the deployment.
- name: Use deploy files from master branch
run: |
git fetch --no-tags --prune --depth=1 origin master
git checkout origin/master -- .github/deploy.sh util/versions.py util/gh-pages/versions.html
# Generate lockfile for caching to avoid build problems with cached deps
- name: cargo generate-lockfile
run: cargo generate-lockfile
- name: Cache
uses: Swatinem/rust-cache@v1.3.0
- name: cargo collect-metadata
run: cargo collect-metadata
2020-01-22 20:00:31 +00:00
- name: Deploy
run: |
eval "$(ssh-agent -s)"
ssh-add - <<< "${{ secrets.DEPLOY_KEY }}"
2020-01-26 14:40:53 +00:00
bash .github/deploy.sh