From faf6cfe57d6c8869a69cba5ad40a942059abf67f Mon Sep 17 00:00:00 2001 From: jonpas Date: Sat, 5 Oct 2019 22:56:41 +0200 Subject: [PATCH] Add Documentation CI Workflow (dependencies, translations) (#7208) * Cleanup Circle CI configuration --- .github/workflows/documentation.yml | 24 ++++++++++++++++++++++++ circle.yml | 24 ------------------------ tools/deploy.py | 13 ++++++------- 3 files changed, 30 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/documentation.yml delete mode 100644 circle.yml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000000..5022af32f4 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,24 @@ +name: Documentation + +on: + push: + branches: + - master + +jobs: + update: + runs-on: ubuntu-latest + steps: + - name: Checkout the source code + uses: actions/checkout@master + - name: Install Python packages + run: | + pip3 install wheel + pip3 install setuptools + pip3 install pygithub + pip3 install pygithub3 + - name: Deploy + if: github.repository == 'acemod/ACE3' && ! contains(github.event.head_commit.message, '[ci skip]') + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: python3 tools/deploy.py diff --git a/circle.yml b/circle.yml deleted file mode 100644 index d666076a79..0000000000 --- a/circle.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: 2 -jobs: - update-docs: - docker: - - image: acemod/armake:latest - steps: - - checkout - - run: - name: Update documentation and translation statistics - command: | - if [ "${CIRCLE_BRANCH}" == "master" ] && [ "${CIRCLE_PROJECT_USERNAME}" == "acemod" ]; then - python3 tools/deploy.py - else - echo "Skipping, not on acemod/ACE3 master branch..." - fi - -workflows: - version: 2 - build-job: - jobs: - - update-docs: - filters: - branches: - only: master diff --git a/tools/deploy.py b/tools/deploy.py index 42b5a825a3..32dade9c3f 100644 --- a/tools/deploy.py +++ b/tools/deploy.py @@ -27,6 +27,8 @@ REPOUSER = "acemod" REPONAME = "ACE3" REPOPATH = "{}/{}".format(REPOUSER,REPONAME) +BRANCH = "master" + def update_translations(repo): diag = sp.check_output(["python3", "tools/stringtablediag.py", "--markdown"]) @@ -41,14 +43,11 @@ def update_dependencies(repo): diff = str(diff, "utf-8") if diff != "": - sha = repo.get_contents(DEPENDENCIESPATH - #, ref="travisForDocs" # Debug - ).sha + sha = repo.get_contents(DEPENDENCIESPATH, ref=BRANCH).sha repo.update_file( - path="/{}".format(DEPENDENCIESPATH), - message="[Docs] Update component dependencies\nAutomatically committed through Travis CI.\n\n[ci skip]", - content=dependencies, sha=sha, committer=InputGitAuthor("ace3mod", "ace3mod@gmail.com") - #, branch="travisForDocs" # Debug + path="{}".format(DEPENDENCIESPATH), + message="[Docs] Update component dependencies\nAutomatically committed through CI.\n\n[ci skip]", + content=dependencies, sha=sha, committer=InputGitAuthor("ace3mod", "ace3mod@gmail.com"), branch=BRANCH ) print("Dependencies successfully updated.") else: