|
| 1 | +name: MacVim Documentation Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'main' |
| 7 | + schedule: |
| 8 | + - cron: "50 3 * * *" # 3:50 am UTC every day. Just a random time intentionally picked to be not during busy hours. |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +# Allow one concurrent deployment |
| 12 | +concurrency: |
| 13 | + group: "pages" |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +env: |
| 17 | + MACVIM_REPO: 'macvim-dev/macvim' |
| 18 | + MACVIM_DIR: ${{ format('{0}/macvim', github.workspace) }} |
| 19 | + |
| 20 | +jobs: |
| 21 | + # Build the page and upload it as an artifact |
| 22 | + build: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + permissions: |
| 25 | + contents: read |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v3 |
| 28 | + |
| 29 | + - name: Checkout MacVim |
| 30 | + uses: actions/checkout@v3 |
| 31 | + with: |
| 32 | + repository: ${{ env.MACVIM_REPO }} |
| 33 | + path: 'macvim' |
| 34 | + |
| 35 | + - uses: actions/setup-python@v4 |
| 36 | + with: |
| 37 | + python-version: '3.x' |
| 38 | + cache: 'pip' |
| 39 | + cache-dependency-path: 'vimhelp/requirements.txt' |
| 40 | + |
| 41 | + - name: Set up vimhelp |
| 42 | + run: | |
| 43 | + pip install -r vimhelp/requirements.txt |
| 44 | +
|
| 45 | + - name: Set up commit / version environmental vars |
| 46 | + run: | |
| 47 | + cd "$MACVIM_DIR" |
| 48 | + printf 'MACVIM_COMMIT=%s\n' $(git rev-parse HEAD) >> $GITHUB_ENV |
| 49 | + printf 'MACVIM_VERSION=%s\n' $(${GITHUB_WORKSPACE}/scripts/extract_macvim_version ./src) >> $GITHUB_ENV |
| 50 | + printf 'VIM_VERSION=%s\n' $(${GITHUB_WORKSPACE}/scripts/extract_vim_version ./src) >> $GITHUB_ENV |
| 51 | +
|
| 52 | + - name: Build the documentation |
| 53 | + run: | |
| 54 | + echo "MacVim commit: ${MACVIM_COMMIT}" |
| 55 | + echo "MacVim release: ${MACVIM_VERSION}" |
| 56 | + echo "Vim version: ${VIM_VERSION}" |
| 57 | +
|
| 58 | + version_string="r${MACVIM_VERSION} (Vim ${VIM_VERSION})" |
| 59 | + echo "Version string: $version_string" |
| 60 | +
|
| 61 | + cd vimhelp |
| 62 | + python3 scripts/h2h.py -i "$MACVIM_DIR/runtime/doc" -o ../build --project macvim --web-version --version "$version_string" --commit "$MACVIM_COMMIT" |
| 63 | +
|
| 64 | + - name: Upload page artifact |
| 65 | + uses: actions/upload-pages-artifact@v1 |
| 66 | + with: |
| 67 | + path: build |
| 68 | + |
| 69 | + # Deploy the artifact to the page |
| 70 | + deploy: |
| 71 | + needs: build |
| 72 | + |
| 73 | + permissions: |
| 74 | + pages: write # to deploy to Pages |
| 75 | + id-token: write # to verify the deployment originates from an appropriate source |
| 76 | + |
| 77 | + environment: |
| 78 | + name: github-pages |
| 79 | + url: ${{ steps.deployment.outputs.page_url }} |
| 80 | + |
| 81 | + runs-on: ubuntu-latest |
| 82 | + steps: |
| 83 | + - name: Deploy to GitHub Pages |
| 84 | + id: deployment |
| 85 | + uses: actions/deploy-pages@v1 |
0 commit comments