Bump actions/cache from 5 to 6 in the dependencies group (#174) #124
This file contains hidden or 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
| # 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 | |
| permissions: | |
| # Nope, we don't need write permission; we use the Penny installation token for that | |
| contents: read | |
| jobs: | |
| cache-toolbox: | |
| uses: ./.github/workflows/test-template.yml | |
| generate-templates: | |
| needs: cache-toolbox | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-generate-templates-${{ 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: actions/create-github-app-token@v3 | |
| with: | |
| client-id: ${{ vars.PENNY_APP_CLIENT_ID }} | |
| private-key: ${{ secrets.PENNY_APP_PRIVATE_KEY }} | |
| owner: vapor | |
| repositories: ${{ matrix.repository }} | |
| - name: Get cached toolbox | |
| uses: actions/cache/restore@v6 | |
| with: | |
| key: ${{ needs.cache-toolbox.outputs.cache-key }} | |
| path: toolbox | |
| fail-on-cache-miss: true | |
| - name: Clone pregenerated template repo | |
| uses: actions/checkout@v7 | |
| with: | |
| repository: vapor/${{ matrix.repository }} | |
| path: old-template-repo | |
| ref: main | |
| token: ${{ steps.get-token.outputs.token }} | |
| - name: Generate template | |
| env: | |
| APP_SLUG: ${{ steps.get-token.outputs.app-slug }} | |
| run: | | |
| APP_BOT_ID="$(curl -fsSL "https://api.github.com/users/${APP_SLUG}%5Bbot%5D" | jq '.id')" | |
| toolbox/vapor new "${{ matrix.repository }}" ${{ matrix.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=${APP_SLUG}[bot]" \ | |
| -c "user.email=${APP_BOT_ID}+${APP_SLUG}[bot]@users.noreply.github.com" \ | |
| commit -m "Autogenerated from ${GITHUB_REPOSITORY}@${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 |