🚀 Deploy #39
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: "Desplegar pagina" | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- "develop" | |
- "production" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
env: | |
DEPLOY: >- | |
${{ | |
github.event_name != 'pull_request' | |
&& | |
(github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/production') | |
}} | |
OUTPUT: _html | |
TZ: America/Bogota | |
jobs: | |
build: | |
name: Construir sitio web lektor | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate access token | |
if: always() | |
id: generate_access_token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ secrets.PYTHON_CO_APP_ID }} | |
private-key: ${{ secrets.PYTHON_CO_APP_KEY }} | |
owner: ${{ github.repository_owner }} | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install Lektor | |
run: | | |
pipx ensurepath | |
pipx install Lektor unidecode | |
- name: Build Lektor site | |
run: lektor build -O '${{ env.OUTPUT }}' | |
- name: Deploy Lektor site - ${{ github.head_ref || github.ref_name }} | |
if: env.DEPLOY == 'true' | |
env: | |
LEKTOR_DEPLOY_USERNAME: lektor | |
LEKTOR_DEPLOY_PASSWORD: ${{ steps.generate_access_token.outputs.token }} | |
run: | | |
lektor deploy -O '${{ env.OUTPUT }}' ${{ github.head_ref || github.ref_name }} |