do not generate keymap if the version are unchanged #101
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: Deploy site | |
on: | |
push: | |
branches: [master] | |
paths-ignore: ['docs/assets/keymap*.json'] | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
outputs: | |
lxl: ${{ steps.version.outputs.lxl }} | |
keymap: ${{ steps.version.outputs.keymap }} | |
keymap_macos: ${{ steps.version.outputs.keymap_macos }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get versions | |
id: version | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
echo "lxl=$(gh -R lite-xl/lite-xl release list --exclude-drafts --exclude-pre-releases --limit 1 --json tagName --jq .[].tagName)" >> "$GITHUB_OUTPUT" | |
echo "keymap=$(jq .version docs/assets/keymap.json)" >> "$GITHUB_OUTPUT" | |
echo "keymap_macos=$(jq .version docs/assets/keymap-macos.json)" >> "$GITHUB_OUTPUT" | |
generate_keymap: | |
uses: ./.github/workflows/generate_keymap.yml | |
needs: version | |
if: needs.version.outputs.lxl != needs.version.outputs.keymap || needs.version.outputs.lxl != needs.version.outputs.keymap_macos | |
secrets: inherit | |
permissions: | |
contents: write | |
pull-requests: write | |
with: | |
lite_xl_version: ${{ needs.version.outputs.lxl }} | |
build: | |
runs-on: ubuntu-latest | |
needs: [version, generate_keymap] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download updated keymaps | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: docs/assets | |
# environment has these deps. | |
# - name: Install dependencies | |
# run: sudo apt-get install libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: pyproject.toml | |
- name: Cache build data | |
uses: actions/cache@v4 | |
with: | |
key: mkdocs-cache-${{ runner.os }}-${{ hashFiles('**/poetry.lock', '**/mkdocs.yml') }} | |
path: .cache | |
- name: Setup environment variables | |
run: | | |
echo "SITE_URL=https://${GITHUB_REPOSITORY%/*}.github.io/${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV | |
echo "REPO_URL=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" >> $GITHUB_ENV | |
- name: Build | |
env: | |
CARDS: 'true' | |
LITE_XL_VERSION: ${{ needs.version.outputs.lxl }} | |
run: uv run mkdocs build | |
- name: Upload page artifact | |
id: deployment | |
uses: actions/upload-pages-artifact@v3 | |
with: { path: site } | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |