Update two commands of defaults (#1098) #652
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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.4.0 | |
GMT_DOC_VERSION: 6.4 | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.11.0 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Checkout the gh-pages branch | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
path: deploy | |
fetch-depth: 0 | |
# Install Mambaforge with conda-forge dependencies | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v2.2.0 | |
with: | |
python-version: 3.9 | |
channels: conda-forge,nodefaults | |
channel-priority: strict | |
miniforge-version: latest | |
miniforge-variant: Mambaforge | |
mamba-version: "*" | |
use-mamba: true | |
- name: Install packages | |
run: | | |
mamba install gmt=${GMT_VERSION} | |
pip install -r requirements.txt | |
- name: Download remote data from GitHub | |
uses: dawidd6/action-download-artifact@v2.27.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 | |
# Chinese configuration | |
gmt text -L | |
cat ~/.gmt/cidfmap | |
cat ~/.gmt/PSL_custom_fonts.txt | |
cd $(gmt --show-sharedir)/localization | |
cp gmt_cn1.locale gmt_cn1.locale_old | |
iconv -f GBK -t UTF-8 gmt_cn1.locale_old > gmt_cn1.locale | |
- name: Build HTML | |
run: make build_html | |
- name: Prepare the documentation for deployment | |
run: | | |
cd deploy | |
# generate the .nojekyll file in the root directory | |
touch .nojekyll | |
# generate CNAME in the root directory | |
echo docs.gmt-china.org > CNAME | |
# Use the old PDF documentation because the new PDF documentation is not built | |
cp ${GMT_DOC_VERSION}/GMT_docs.pdf ../build/dirhtml/ | |
# Replace the old documentation with tht new one. | |
rm -rvf ${GMT_DOC_VERSION} | |
cp -rvf ../build/dirhtml/ ${GMT_DOC_VERSION}/ | |
# let "latest" link to the latest version | |
rm -rfv latest | |
ln -sfv ${GMT_DOC_VERSION} latest | |
cd .. | |
- name: Deploy the HTML documentation to gh-pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force_orphan: true | |
publish_dir: deploy | |
- name: Install TinyTeX | |
uses: r-lib/actions/setup-tinytex@v2 | |
- name: Install LaTeX packages | |
run: | | |
tlmgr update --self | |
tlmgr install capt-of caption colortbl ctex enumitem everysel fancyhdr fandol \ | |
float ms needspace oberdiek parskip pdftexcmds tabulary \ | |
titlesec ulem upquote varwidth wrapfig xcolor xecjk \ | |
xindy zhnumber | |
# install packages for GMT LaTeX integration | |
tlmgr install collection-fontsrecommended | |
- name: Build PDF | |
run: make build_pdf | |
- name: Prepare the documentation for deployment | |
run: | | |
cp build/dirhtml/GMT_docs.pdf deploy/${GMT_DOC_VERSION}/ | |
- name: Deploy the PDF documentation to gh-pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force_orphan: true | |
publish_dir: deploy |