|
| 1 | +version: 2 |
| 2 | +general: |
| 3 | + artifacts: |
| 4 | + |
| 5 | +jobs: |
| 6 | + build: |
| 7 | + docker: |
| 8 | + - image: lktp/publish:0.2 |
| 9 | + environment: |
| 10 | + GITHUB_IO=git@github.com:linux-kernel-labs/linux-kernel-labs.github.io.git |
| 11 | + steps: |
| 12 | + - restore_cache: |
| 13 | + key: code-tree-shallow |
| 14 | + - run: |
| 15 | + name: checkout |
| 16 | + command: | |
| 17 | + set -x |
| 18 | + mkdir -p ~/.ssh/ |
| 19 | + ssh-keyscan -H github.com >> ~/.ssh/known_hosts |
| 20 | + git config --global user.email "circle.ci@kltp.org" |
| 21 | + git config --global user.name "Circle CI" |
| 22 | + if ! [ -d linux ]; then |
| 23 | + git clone --depth=1 $CIRCLE_REPOSITORY_URL; |
| 24 | + fi |
| 25 | + if cd linux; then |
| 26 | + if [[ $CIRCLE_BRANCH == pull/* ]]; then |
| 27 | + git fetch --depth=1 origin $CIRCLE_BRANCH/head; |
| 28 | + else |
| 29 | + git fetch --depth=1 origin $CIRCLE_BRANCH; |
| 30 | + fi |
| 31 | + git reset --hard $CIRCLE_SHA1 |
| 32 | + cd .. |
| 33 | + fi |
| 34 | + if ! [ -d linux-kernel-labs.github.io ]; then |
| 35 | + git clone --depth=1 $GITHUB_IO |
| 36 | + fi |
| 37 | + if cd linux-kernel-labs.github.io; then |
| 38 | + git fetch --depth=1 origin master |
| 39 | + git reset --hard origin/master |
| 40 | + cd .. |
| 41 | + fi |
| 42 | + - save_cache: |
| 43 | + key: code-tree-shallow-{{ epoch }} |
| 44 | + paths: |
| 45 | + - /home/ubuntu/project/linux/.git |
| 46 | + - /home/ubuntu/project/linux-kernel-labs.github.io/.git |
| 47 | + - run: |
| 48 | + name: build |
| 49 | + command: | |
| 50 | + rm -rf linux/Documentation/output |
| 51 | + cd linux/tools/labs && make docs |
| 52 | + - add_ssh_keys: |
| 53 | + fingerprints: |
| 54 | + "8e:db:3c:ef:d0:4e:84:9f:78:46:e9:2f:1a:1e:32:81" |
| 55 | + - run: |
| 56 | + name: publish |
| 57 | + command: | |
| 58 | + set -x |
| 59 | + if cd linux-kernel-labs.github.io; then |
| 60 | + rm -rf $CIRCLE_BRANCH |
| 61 | + mkdir -p $CIRCLE_BRANCH |
| 62 | + cp -r ../linux/Documentation/output/teaching/* $CIRCLE_BRANCH/ |
| 63 | + git add $CIRCLE_BRANCH/ |
| 64 | + git commit --allow-empty -m "Publish $CIRCLE_BRANCH (built from ${CIRCLE_PULL_REQUEST:-$CIRCLE_BRANCH})" |
| 65 | + git push |
| 66 | + export GITHUB_SHA=$CIRCLE_SHA1 |
| 67 | + export GITHUB_USER=linux-kernel-labs |
| 68 | + export GITHUB_REPO=$CIRCLE_PROJECT_REPONAME |
| 69 | + export GITHUB_CONTEXT="ci/circleci: publish" |
| 70 | + export GITHUB_TARGET_URL="http://linux-kernel-labs.github.io/$CIRCLE_BRANCH" |
| 71 | + export GITHUB_DESCRIPTION="published at $GITHUB_TARGET_URL" |
| 72 | + github-status-reporter --state success --debug |
| 73 | + cd .. |
| 74 | + fi |
| 75 | +
|
| 76 | +workflows: |
| 77 | + version: 2 |
| 78 | + build: |
| 79 | + jobs: |
| 80 | + - build |
0 commit comments