Skip to content

Commit

Permalink
simplify ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Oct 21, 2023
1 parent 7801522 commit 7297b08
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
abort: ${{ steps.debounce.outputs.abort }}
steps:
- name: Debounce
if: github.event_name == 'push'
if: github.ref_name != 'main' && github.event_name == 'push'
id: debounce
run: |
pr_branches=$(gh pr list --json headRefName --repo $GITHUB_REPOSITORY)
Expand Down
81 changes: 62 additions & 19 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,76 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy docs to GitHub Pages
name: Lint Docs

on:
# Runs on pushes targeting the default branch and docs path
push:
branches: ['main']
paths-ignore: ['**/*.yml', '!**/docs.yml']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
paths: ['**/*.md', '**/docs.yml']
pull_request:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: 'pages'
cancel-in-progress: false
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
REPO_NAME: ${{ github.event.repository.name }}
MOD_PATH: ~/.vmodules/vibe/

jobs:
# Single deploy job since we're just deploying
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: ${{ runner.os }}-${{ 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 }}
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@v3
Expand Down
63 changes: 0 additions & 63 deletions .github/workflows/lint-docs.yml

This file was deleted.

0 comments on commit 7297b08

Please sign in to comment.