Fixes the post-release-templates workflow by building payload before running the gen templates script --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1210784057163370
122 lines
4.6 KiB
YAML
122 lines
4.6 KiB
YAML
name: post-release-templates
|
|
|
|
on:
|
|
release:
|
|
types:
|
|
- published
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
DO_NOT_TRACK: 1 # Disable Turbopack telemetry
|
|
NEXT_TELEMETRY_DISABLED: 1 # Disable Next telemetry
|
|
|
|
jobs:
|
|
wait_for_release:
|
|
runs-on: ubuntu-24.04
|
|
outputs:
|
|
release_tag: ${{ steps.determine_tag.outputs.release_tag }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
sparse-checkout: .github/workflows
|
|
|
|
- name: Determine Release Tag
|
|
id: determine_tag
|
|
run: |
|
|
if [ "${{ github.event_name }}" == "release" ]; then
|
|
echo "Using tag from release event: ${{ github.event.release.tag_name }}"
|
|
echo "release_tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
|
|
else
|
|
# pull latest tag from github, must match any version except v2. Should match v3, v4, v99, etc.
|
|
echo "Fetching latest tag from github..."
|
|
LATEST_TAG=$(git describe --tags --abbrev=0 --match 'v[0-9]*' --exclude 'v2*')
|
|
echo "Latest tag: $LATEST_TAG"
|
|
echo "release_tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Wait until latest versions resolve on npm registry
|
|
run: |
|
|
./.github/workflows/wait-until-package-version.sh payload ${{ steps.determine_tag.outputs.release_tag }}
|
|
./.github/workflows/wait-until-package-version.sh @payloadcms/translations ${{ steps.determine_tag.outputs.release_tag }}
|
|
./.github/workflows/wait-until-package-version.sh @payloadcms/next ${{ steps.determine_tag.outputs.release_tag }}
|
|
|
|
update_templates:
|
|
needs: wait_for_release
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: payloadtests
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup
|
|
uses: ./.github/actions/setup
|
|
|
|
- name: Start PostgreSQL
|
|
uses: CasperWA/postgresql-action@v1.2
|
|
with:
|
|
postgresql version: '14' # See https://hub.docker.com/_/postgres for available versions
|
|
postgresql db: ${{ env.POSTGRES_DB }}
|
|
postgresql user: ${{ env.POSTGRES_USER }}
|
|
postgresql password: ${{ env.POSTGRES_PASSWORD }}
|
|
|
|
- name: Wait for PostgreSQL
|
|
run: sleep 30
|
|
|
|
- name: Configure PostgreSQL
|
|
run: |
|
|
psql "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:5432/$POSTGRES_DB" -c "CREATE ROLE runner SUPERUSER LOGIN;"
|
|
psql "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:5432/$POSTGRES_DB" -c "SELECT version();"
|
|
echo "POSTGRES_URL=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:5432/$POSTGRES_DB" >> $GITHUB_ENV
|
|
echo "DATABASE_URI=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:5432/$POSTGRES_DB" >> $GITHUB_ENV
|
|
|
|
- name: Start MongoDB
|
|
uses: supercharge/mongodb-github-action@1.12.0
|
|
with:
|
|
mongodb-version: 6.0
|
|
|
|
# The template generation script runs import map generation which needs the built payload bin scripts
|
|
- run: pnpm run build:all
|
|
env:
|
|
DO_NOT_TRACK: 1 # Disable Turbopack telemetry
|
|
|
|
- name: Update template lockfiles and migrations
|
|
run: pnpm script:gen-templates
|
|
|
|
- name: Commit and push changes
|
|
id: commit
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
set -ex
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
git diff --name-only
|
|
|
|
export BRANCH_NAME=templates/bump-${{ needs.wait_for_release.outputs.release_tag }}-$(date +%s)
|
|
echo "branch=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Create pull request
|
|
uses: peter-evans/create-pull-request@v7
|
|
with:
|
|
token: ${{ secrets.GH_TOKEN_POST_RELEASE_TEMPLATES }}
|
|
labels: 'area: templates'
|
|
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
|
commit-message: 'templates: bump templates for ${{ needs.wait_for_release.outputs.release_tag }}'
|
|
branch: ${{ steps.commit.outputs.branch }}
|
|
base: main
|
|
assignees: ${{ github.actor }}
|
|
title: 'templates: bump for ${{ needs.wait_for_release.outputs.release_tag }}'
|
|
body: |
|
|
🤖 Automated bump of templates for ${{ needs.wait_for_release.outputs.release_tag }}
|
|
|
|
Triggered by user: @${{ github.actor }}
|