From 2070cee099aba26cc820fdcbf46cc7f4a350b6c7 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 21 Oct 2019 08:03:14 -0700 Subject: [PATCH] Test --- .github/workflows/deploy.yml | 9 +-------- ci/deploy-gh-pages.sh | 12 ++++++++++++ ci/make-release.sh | 8 +++++--- 3 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 ci/deploy-gh-pages.sh diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bd19dd3096..b0e862168a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -32,12 +32,5 @@ jobs: - uses: actions/checkout@master - name: Install Rust (rustup) run: rustup update stable --no-self-update && rustup default stable - - name: Build gh-pages - run: cargo run -- build book-example - name: Deploy to GitHub Pages - run: | - touch book-example/book/.nojekyll - curl -LsSf https://raw.githubusercontent.com/rust-lang/simpleinfra/master/setup-deploy-keys/src/deploy.rs | rustc - -o /tmp/deploy - (cd book-example/book && /tmp/deploy) - env: - GITHUB_DEPLOY_KEY: ${{ secrets.GITHUB_DEPLOY_KEY }} + run: ci/deploy-gh-pages.sh diff --git a/ci/deploy-gh-pages.sh b/ci/deploy-gh-pages.sh new file mode 100644 index 0000000000..987c8c9f3c --- /dev/null +++ b/ci/deploy-gh-pages.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Updates gh-pages with latest docs. +set -ex + +cargo run -- build book-example +cd book-example/book +touch .nojekyll +git init +git add . +git commit -m "Deploy to gh-pages" +remote="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" +git push "$remote" HEAD:gh-pages --force diff --git a/ci/make-release.sh b/ci/make-release.sh index d87b70f0b5..e8a41fdb17 100755 --- a/ci/make-release.sh +++ b/ci/make-release.sh @@ -7,17 +7,19 @@ then echo "GITHUB_REF must be set" exit 1 fi +# Strip mdbook-refs/tags/ from the start of the ref. +TAG=${GITHUB_REF#*/tags/} host=$(rustc -Vv | grep ^host: | sed -e "s/host: //g") cargo rustc --bin mdbook --release -- -C lto cd target/release case $1 in ubuntu* | macos*) - asset="mdbook-$GITHUB_REF-$host.tar.gz" + asset="mdbook-$TAG-$host.tar.gz" tar czf ../../$asset mdbook ;; windows*) - asset="mdbook-$GITHUB_REF-$host.zip" + asset="mdbook-$TAG-$host.zip" 7z a ../../$asset mdbook.exe ;; *) @@ -29,5 +31,5 @@ if [[ -z "GITHUB_TOKEN" ]] then echo "$GITHUB_TOKEN not set, skipping deploy." else - hub release edit --attach $asset $GITHUB_REF + hub release edit --attach $asset $TAG fi