ci: simplify, update concurrency, add macOS workflow #32
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: Lint Docs | |
on: | |
push: | |
paths: ['**/*.md', '**/docs.yml'] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
REPO_NAME: ${{ github.event.repository.name }} | |
MOD_PATH: ~/.vmodules/vibe/ | |
jobs: | |
debounce: | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ github.token }} | |
outputs: | |
abort: ${{ steps.debounce.outputs.abort }} | |
steps: | |
- name: Debounce | |
if: github.ref_name != 'main' && github.event_name == 'push' | |
id: debounce | |
run: | | |
pr_branches=$(gh pr list --json headRefName --repo $GITHUB_REPOSITORY) | |
if [[ $(echo "$pr_branches" | jq -r --arg GITHUB_REF '.[].headRefName | select(. == $GITHUB_REF)') ]]; then | |
echo "This push is associated with a pull request. Skipping the job." | |
echo "abort=true" >> "$GITHUB_OUTPUT" | |
fi | |
check-docs: | |
runs-on: ubuntu-latest | |
needs: debounce | |
if: needs.debounce.outputs.abort != 'true' | |
steps: | |
- name: Restore Cache | |
id: cache-status | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
vlang | |
~/.vmodules | |
key: ubuntu-latest${{ github.sha }} | |
- name: Setup V | |
uses: vlang/[email protected] | |
- name: Setup Dependencies | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: libcurl4-openssl-dev | |
version: 1.0 | |
- name: Checkout ${{ env.REPO_NAME }} | |
if: ${{ steps.cache-status.outputs.cache-hit != 'true' }} | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.REPO_NAME }} | |
- name: Copy ${{ env.REPO_NAME }} to .vmodules | |
if: ${{ steps.cache-status.outputs.cache-hit != 'true' }} | |
run: cp -r ${{ env.REPO_NAME }} ${{ env.MOD_PATH }} | |
- name: Check Markdown | |
run: v check-md -hide-warnings ${{ env.MOD_PATH }} | |
deploy: | |
concurrency: | |
group: pages | |
cancel-in-progress: false | |
runs-on: ubuntu-latest | |
if: github.ref_name == 'main' && github.event_name == 'push' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Install V | |
uses: vlang/[email protected] | |
with: | |
check-latest: true | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build docs | |
run: docs/build.vsh | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: 'docs/site' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |