Skip to content

Add example of buffer #2072

Add example of buffer

Add example of buffer #2072

Workflow file for this run

# Build and preview documentation in PRs.
# DOES NOT WORK FOR FORKS.
name: Preview PR
on:
pull_request:
jobs:
preview-pr:
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
# 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 -c conda-forge gmt=${GMT_VERSION}
pip install -r requirements.txt
# Install packages for GMT LaTeX integration
sudo apt update
sudo apt install texlive-latex-base texlive-binaries texlive-fonts-recommended
- 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
- 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: Deploy for preview
uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305
with:
# personal token can be generated at https://github.com/settings/tokens,
# and added to https://github.com/organizations/gmt-china/settings/secrets/actions
personal_token: ${{ secrets.TOKEN_DOCUMENT_DEPLOY }}
publish_dir: ./build/dirhtml
destination_dir: ${{ github.repository }}/${{ github.head_ref }}
external_repository: gmt-china/sitepreview
keep_files: false
allow_empty_commit: true
force_orphan: false
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
if: github.event.pull_request.head.repo.full_name == github.repository
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: This comment was written by the Continuous Documentation bot!
if: github.event.pull_request.head.repo.full_name == github.repository
- name: Create comment
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
This comment was written by the Continuous Documentation bot!
- **Preview**: https://gmt-china.github.io/sitepreview/${{ github.repository }}/${{ github.head_ref }}/index.html
- **Commit hash**: ${{ github.event.pull_request.head.sha }}
if: github.event.pull_request.head.repo.full_name == github.repository && steps.fc.outputs.comment-id == 0
- name: Update comment
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: |
This comment was written by the Continuous Documentation bot!
- **Preview**: https://gmt-china.github.io/sitepreview/${{ github.repository }}/${{ github.head_ref }}/index.html
- **Commit hash**: ${{ github.event.pull_request.head.sha }}
if: github.event.pull_request.head.repo.full_name == github.repository && steps.fc.outputs.comment-id != 0