Skip to content

Deploy website

Deploy website #22

name: Deploy website
on: workflow_dispatch
concurrency:
group: docs-website
env:
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
deploy:
name: Cloudflare Pages
runs-on: ubuntu-latest
environment:
name: stockindicators.dev
url: https://python.stockindicators.dev
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: docs
ruby-version: 3.3
- name: Define tag
id: tag
run: echo "version=$(date +'%Y.%m.%d')-${{ github.run_number }}" >> $GITHUB_OUTPUT
- name: Replace cache markers
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "YYYY.MM.DD"
replace: "${{ steps.tag.outputs.version }}"
regex: false
- name: Install GEMs
working-directory: docs
env:
BUNDLE_GEMFILE: ${{github.workspace}}/docs/GemFile
run: |
pwd
bundle install
- name: Build site (production)
if: github.ref == 'refs/heads/main'
working-directory: docs
env:
JEKYLL_ENV: production
BUNDLE_GEMFILE: ${{github.workspace}}/docs/GemFile
run: bundle exec jekyll build
- name: Build site (preview)
if: github.ref != 'refs/heads/main'
working-directory: docs
env:
JEKYLL_ENV: preview
BUNDLE_GEMFILE: ${{github.workspace}}/docs/GemFile
run: bundle exec jekyll build
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_KEY }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
directory: docs/_site
wranglerVersion: 'latest'