Skip to content

Deploy website

Deploy website #21

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: ${{ steps.deploy.outputs.deployment-alias-url }}
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
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_KEY }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
wranglerVersion: "latest"
command: >
pages deploy docs/_site
--project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }}