release: 0.11.3 #36
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
name: Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
name: Create release and update documentation | |
steps: | |
- name: Set variables | |
id: vars | |
run: | | |
echo "::set-output name=tag::${GITHUB_REF#refs/*/}" | |
echo "::set-output name=target_branch::gh-pages" | |
echo "::set-output name=latest_name::latest" | |
- name: Check out main branch | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Check out documentation branch | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ steps.vars.outputs.target_branch }} | |
path: ${{ steps.vars.outputs.target_branch }} | |
persist-credentials: false | |
- name: Cache nimble | |
id: cache-nimble | |
uses: actions/cache@v2 | |
with: | |
path: ~/.nimble | |
key: ${{ runner.os }}-nimble | |
if: runner.os != 'Windows' | |
- name: Set up Nim | |
uses: jiro4989/setup-nim-action@v1 | |
with: | |
nim-version: stable | |
- name: Build documentation | |
run: nimble docs | |
- name: Generate landing page | |
run: | | |
nim r --hints:off --verbosity:0 $GITHUB_WORKSPACE/docsrc/build_index.nim $GITHUB_WORKSPACE | |
- name: Copy documentation | |
run: | | |
rm -rf ./${{ steps.vars.outputs.latest_name }} | |
cp -r $GITHUB_WORKSPACE/docs ./${{ steps.vars.outputs.latest_name }} | |
cp -r $GITHUB_WORKSPACE/docs ./${{ steps.vars.outputs.tag }} | |
working-directory: ./${{ steps.vars.outputs.target_branch }} | |
- name: Deploy documentation | |
uses: JamesIves/github-pages-deploy-action@3.7.1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: ${{ steps.vars.outputs.target_branch }} | |
FOLDER: ${{ steps.vars.outputs.target_branch }} | |
GIT_CONFIG_NAME: GitHub Action | |
GIT_CONFIG_EMAIL: action@github.com | |
COMMIT_MESSAGE: 'docs: update documentation to ${{ steps.vars.outputs.tag }}' | |
# this is necessary to make retrieving the previous tag possible | |
# without it, the previous tag is somehow the same as the current tag | |
# this seems to be because of actions/checkout@2 | |
- name: Clean git tags | |
run: git fetch --prune --unshallow --tags --force | |
- name: Install fugitive | |
run: nimble install -y fugitive | |
- name: Create changelog | |
id: changelog | |
run: | | |
TAG=${{ steps.vars.outputs.tag }} | |
LAST_TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1)) | |
echo 'CHANGELOG_BODY<<EOF' >> $GITHUB_ENV | |
fugitive changelog --tag:${TAG} --last-tag:${LAST_TAG} --no-anchor --no-title --no-divider >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.vars.outputs.tag }} | |
release_name: ${{ steps.vars.outputs.tag }} | |
body: ${{ env.CHANGELOG_BODY }} |