Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to GitHub Actions #264

Merged
merged 22 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#
# Build and deploy the documentation
#
name: Deploy

on:
#pull_request: # enable pull_request for testing
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
env:
GMT_VERSION: 6.1.1
core-man marked this conversation as resolved.
Show resolved Hide resolved
GMT_DOC_VERSION: 6.1
defaults:
run:
shell: bash -l {0}
steps:
# Cancel previous runs that are not completed
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.0

- name: Checkout
uses: actions/checkout@v2.3.4

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2.1.1
with:
python-version: 3.8
channels: conda-forge
miniconda-version: "latest"

- name: Install packages
run: |
conda install gmt=${GMT_VERSION}
pip install -r requirements.txt

# Download cached remote files (artifacts) from GitHub
- name: Download remote data from GitHub
uses: dawidd6/action-download-artifact@v2.13.0
with:
workflow: cache-data.yml
workflow_conclusion: success
name: gmt-cache
path: .gmt

# Move downloaded files to ~/.gmt directory and list them
- name: Move and list downloaded remote files
run: |
mkdir -p ~/.gmt
mv .gmt/* ~/.gmt
# Change modification times of the two files, so GMT won't refresh it
touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/gmt_hash_server.txt
ls -lhR ~/.gmt

- name: Build HTML
run: make build_html

- name: Install TinyTeX
uses: r-lib/actions/setup-tinytex@v1

- name: Install LaTeX packages
run: |
tlmgr install capt-of caption ctex enumitem everysel fancyhdr fandol \
float ms needspace oberdiek parskip pdftexcmds tabulary \
titlesec ulem upquote varwidth wrapfig xcolor xecjk \
xindy zhnumber

- name: Build PDF
run: make build_pdf

- name: Checkout the gh-pages branch
uses: actions/checkout@v2.3.4
with:
ref: gh-pages
path: deploy
fetch-depth: 0

- name: Push the documentation to gh-pages
run: |
cd deploy
touch .nojekyll
# Update the directory
rm -rvf ${GMT_DOC_VERSION}
cp -rvf ../build/dirhtml/ ${GMT_DOC_VERSION}/
# let "latest" link to the latest version
rm -f latest
ln -sf ${GMT_DOC_VERSION} latest
# commit all changes
git add -A .
core-man marked this conversation as resolved.
Show resolved Hide resolved
git status
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
message="Deploy ${GITHUB_SHA::8}"
git commit --amend --reset-author -m "$message"
git push -fq origin gh-pages 2>&1 >/dev/null
96 changes: 0 additions & 96 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# GMT中文手册

[![Build Status](https://travis-ci.org/gmt-china/GMT_docs.svg?branch=master)](https://travis-ci.org/gmt-china/GMT_docs)
[![Deploy](https://github.com/gmt-china/GMT_docs/actions/workflows/deploy.yml/badge.svg)](https://github.com/gmt-china/GMT_docs/actions/workflows/deploy.yml)
[![Documentation version](https://img.shields.io/badge/版本-v6.1-blue.svg)](https://docs.gmt-china.org/6.1/)
![Repository size](https://img.shields.io/github/repo-size/gmt-china/GMT_Docs)
seisman marked this conversation as resolved.
Show resolved Hide resolved
[![License: CC BY-NC 4.0](https://img.shields.io/badge/License-CC%20BY--NC%204.0-blue.svg)](https://creativecommons.org/licenses/by-nc/4.0/deed.zh)

[在线阅读](https://docs.gmt-china.org/6.1/) |
[PDF下载](https://docs.gmt-china.org/6.1/GMT_docs.pdf) |
Expand Down
4 changes: 2 additions & 2 deletions source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
"conf_py_path": "/source/",
"theme_vcs_pageview_mode": "blob",
"metatags": '<meta name="msvalidate.01" content="C8D87DC3FFCED00C7F2FC8FD35051386" />',
# Enable version switch on Travis
"enable_versions_switch": True if os.getenv("TRAVIS") else False,
# Enable version switch on GitHub Actions
"enable_versions_switch": True if os.getenv("GITHUB_ACTIONS") else False,

"menu_links": [
(
Expand Down