create-release-pr #23
This file contains 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
name: create-release-pr | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Version to release (ex. `0.1.0`) | |
required: false | |
type: string | |
jobs: | |
create-release-pr: | |
permissions: | |
id-token: write | |
pull-requests: write | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the full repository history | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# Set up caching | |
- uses: Swatinem/rust-cache@v2 | |
- name: Cache default PGRX_HOME | |
uses: actions/cache@v3 | |
continue-on-error: false | |
with: | |
path: | | |
/home/runner/.pgrx | |
key: pg_idkit-pkg-rpm-pgrx-${{ matrix.config.rpm.arch }}-${{ runner.os }} | |
# Install deps | |
- uses: chainguard-dev/actions/setup-gitsign@main | |
- name: Install cargo-release | |
uses: taiki-e/cache-cargo-install-action@v1 | |
with: | |
tool: cargo-release | |
- name: Install just | |
uses: taiki-e/cache-cargo-install-action@v1 | |
with: | |
tool: just | |
- name: Install cargo-get | |
uses: taiki-e/cache-cargo-install-action@v1 | |
with: | |
tool: cargo-get | |
- name: Install cargo-pgrx | |
uses: taiki-e/cache-cargo-install-action@v1 | |
with: | |
tool: cargo-pgrx | |
- name: Install git-cliff | |
uses: taiki-e/cache-cargo-install-action@v1 | |
with: | |
tool: git-cliff | |
- name: Install cargo-edit | |
uses: taiki-e/cache-cargo-install-action@v1 | |
with: | |
tool: cargo-edit | |
# Initialize PGRX | |
- name: Initialize cargo-pgrx | |
run: | | |
[[ -d /home/runner/.pgrx ]] || cargo pgrx init | |
# Prep the project | |
- name: Detect version (current or input) | |
id: detect-version | |
env: | |
VERSION: ${{ inputs.version }} | |
run: | | |
echo value=$(just print-version) >> $GITHUB_OUTPUT | |
- name: Set version | |
env: | |
VERSION: ${{ steps.detect-version.outputs.value }} | |
run: | | |
just set-version $VERSION | |
- name: Generate Changelog | |
env: | |
VERSION: ${{ steps.detect-version.outputs.value }} | |
run: | | |
just changelog | |
# Create PR for release | |
- uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.RELEASE_PR_PAT }} | |
signoff: true | |
commit-message: | | |
release: pg_idkit ${{ steps.detect-version.outputs.value }} | |
title: | | |
Release pg_idkit v${{ steps.detect-version.outputs.value }} | |
body: | | |
This is a release prep branch for `pg_idkit` release v${{ steps.detect-version.outputs.value }}. | |
Upon merging, this branch will cause a tag to be placed on the commit in `main`. After the tag has been placed, a build will run that generates artifacts and publishes a release. | |
See CHANGELOG for changes made to this release before it goes out. | |
labels: | | |
release-pr | |
reviewers: | | |
t3hmrman | |
branch: prep-release-v${{ steps.detect-version.outputs.value }} |