Skip to content

Build And Publish

Build And Publish #267

name: Build And Publish
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * *'
push:
branches:
- main
pull_request:
branches:
- main
# ONLY EVER RUN ONE
concurrency: ${{ github.workflow }}
jobs:
build-and-publish:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Clean up runner
if: ${{ !env.ACT }}
run: |
rm -f ~/.ssh/*
rm -f ~/.gitconfig
continue-on-error: true
- name: Clean Workspace
if: ${{ !env.ACT }}
uses: AutoModality/action-clean@d004b47eb728f2a83316fc70ba9a62ef97278013 # v1.1.0
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
# if: ${{ !env.ACT }}
name: pulling the branch
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6.10' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- uses: actions/cache@v3
id: cache-build
with:
path: build/
key: ${{ runner.os }}-build
- name: "Build"
run: |
bundle exec middleman build --verbose
- name: Publish to Cloudflare Pages
id: deploy
uses: cloudflare/pages-action@v1
if: ${{ github.actor != 'dependabot[bot]' }}
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: zwift-ical
directory: build
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: main