Skip to content

Explain what Fluent and Leaf are (#109) #65

Explain what Fluent and Leaf are (#109)

Explain what Fluent and Leaf are (#109) #65

# This action gets a cached build of the toolbox, runs vapor new for each set of flags in the matrix,
# and pushes the generated template to the corresponding repo.
#
# It can be manually dispatched to force regeneration of the individual template repos.
name: Create templates
on:
push:
branches:
- main
workflow_dispatch:
inputs:
dry_run:
description: 'If true (the default), the updated templates are not pushed to their repositories.'
required: false
default: true
type: boolean
jobs:
cache-toolbox:
uses: ./.github/workflows/test-template.yml
generate-templates:
needs: cache-toolbox
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ toJSON(matrix) }}
cancel-in-progress: false
strategy:
fail-fast: false
matrix:
include:
# No Fluent or Leaf repo
- repository: template-bare
flags: --no-fluent --no-leaf
# SQLite repo
- repository: template-fluent-sqlite
flags: --fluent.db sqlite --no-leaf
# MySQL repo
- repository: template-fluent-mysql
flags: --fluent.db mysql --no-leaf
# Postgres repo
- repository: template-fluent-postgres
flags: --fluent.db postgres --no-leaf
# Postgres with Leaf repo
- repository: template-fluent-postgres-leaf
flags: --fluent.db postgres --leaf
runs-on: ubuntu-latest
steps:
- name: Get token
id: get-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ vars.PENNY_APP_ID }}
private_key: ${{ secrets.PENNY_APP_PRIVATE_KEY }}
repository: vapor/${{ matrix.repository }}
- name: Get cached toolbox
uses: actions/cache/restore@v3
with:
key: ${{ needs.cache-toolbox.outputs.cache_key }}
path: toolbox
fail-on-cache-miss: true
- name: Clone pregenerated template repo
uses: actions/checkout@v4
with:
repository: vapor/${{ matrix.repository }}
path: template-repo
ref: main
token: ${{ steps.get-token.outputs.token }}
- name: Generate template
env:
REPOSITORY: ${{ matrix.repository }}
FLAGS: ${{ matrix.flags }}
GITHUB_REPOSITORYURL: ${{ github.repositoryUrl }}
run: |
mv template-repo old-template-repo
toolbox/vapor new ${REPOSITORY} ${FLAGS} --no-git -o template-repo
mv old-template-repo/.git template-repo/.git
cd template-repo
git add -A
git diff-index --quiet HEAD && exit 0 || true
git -c 'user.name=Penny[bot]' -c 'user.email=360798+penny[bot]@vapor.codes' \
commit -m "Autogenerated from ${GITHUB_REPOSITORYURL}@${GITHUB_SHA}"
- name: Push generated template
env:
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }}
run: |
if [ "${DRY_RUN}" = 'false' ]; then
git -C template-repo push
else
git -C template-repo log -1 -p
fi