diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 6d8b5f533bee..000000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,57 +0,0 @@ -version: 2 -jobs: - build: - docker: - - image: cimg/ruby:2.7-node - steps: - - run: - name: Checkout - command: | - git init - git remote add origin https://github.com/pytorch/pytorch.github.io - git fetch --depth 1 - git checkout site - - restore_cache: - keys: - - pytorch-gem-cache-{{ checksum "Gemfile.lock" }} - - pytorch-gem-cache- - - run: - name: Bundle Install - command: | - bundle config set --local path 'vendor/bundle' - bundle install - - save_cache: - key: pytorch-gem-cache-{{ checksum "Gemfile.lock" }} - paths: - - vendor/bundle - - restore_cache: - keys: - - pytorch-yarn-{{ checksum "yarn.lock" }} - - pytorch-yarn- - - run: - name: Yarn Install - command: yarn install --cache-folder ~/.cache/yarn - - run: - name: Notedown Install - command: sudo apt update && sudo apt install python3-pip && sudo -H pip3 install pyrsistent==0.16 notedown pyyaml -Iv nbformat==5.7 - - save_cache: - key: pytorch-yarn-{{ checksum "yarn.lock" }} - paths: - - ~/.cache/yarn - - run: - name: Configure CircleCI Bot - command: | - git config --global user.email "facebook-circleci-bot@users.noreply.github.com" - git config --global user.name "Website Deployment Script" - - run: - name: Build Jekyll site and push to master - command: ./scripts/deploy-site.sh build - -workflows: - version: 2 - workflow-build: - jobs: - - build: - filters: - branches: - only: site diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000000..bd63cd6720e7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: Build + +on: + push: + branches: + - site + workflow_dispatch: + +jobs: + tests: + uses: pytorch/test-infra/.github/workflows/linux_job.yml@main + with: + runner: linux.12xlarge + repository: pytorch/pytorch.github.io + docker-image: cimg/ruby:2.7-node + secrets-env: PYTORCHBOT_TOKEN + script: | + git config --global --add safe.directory /__w/pytorch.github.io/pytorch.github.io + set -euxo pipefail + + ## Bundle Install + cd + mkdir .bundle + bundle config path '~/vendor/bundle' + git clone https://github.com/pytorch/pytorch.github.io.git + cd pytorch.github.io + bundle install + + ## Yarn Install + yarn install --cache-folder ~/.cache/yarn + + ## Notedown Install + sudo apt update && sudo apt install python3-pip && sudo -H pip3 install pyrsistent==0.16 notedown pyyaml -Iv nbformat==5.7 + + ## Configure Bot + git config --global user.email "facebook-circleci-bot@users.noreply.github.com" + git config --global user.name "Website Deployment Script" + + ## Build Jekyll site and push to master + ./scripts/deploy-site.sh build diff --git a/scripts/deploy-site.sh b/scripts/deploy-site.sh index 15152db13f82..ae0b0ca1f561 100755 --- a/scripts/deploy-site.sh +++ b/scripts/deploy-site.sh @@ -5,7 +5,7 @@ # Used with their MIT license https://github.com/eldarlabs/ghpages-deploy-script/blob/master/LICENSE # abort the script if there is a non-zero error -set -e +set -ex # initialize hub submodule git submodule deinit -f . && git submodule update --init --recursive @@ -57,7 +57,7 @@ git add -A # now commit, ignoring branch master doesn't seem to work, so trying skip git commit --allow-empty -m "Deploy to GitHub Pages on master [ci skip]" # and push, but send any output to /dev/null to hide anything sensitive -git push --force --quiet https://facebook-circleci-bot:$CIRCLECI_PUBLISH_TOKEN@github.com/pytorch/pytorch.github.io.git master +git push --force --quiet https://pytorchbot:$PYTORCHBOT_TOKEN@github.com/pytorch/pytorch.github.io.git master # go back to where we started and remove the master git repo we made and used # for deployment cd ..