allow rds_security_group_id to be empty (#12) #53
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: Changeset and Tag Releases | |
on: | |
push: | |
branches: | |
- "main" | |
- "release/*" | |
permissions: | |
id-token: write | |
contents: write | |
pull-requests: write | |
jobs: | |
changeset: | |
name: Changeset | |
runs-on: ubuntu-latest | |
# Map a step output to a job output | |
outputs: | |
published: ${{ steps.publish.outputs.published }} | |
tag: ${{ steps.publish.outputs.tag }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Setup Node.JS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.12 | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run Changesets Action | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
title: Version Packages for ${{ github.head_ref || github.ref_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish | |
id: publish | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
# Push a new tag when changesets have been merged. | |
run: | | |
echo publishing | |
pnpm changeset tag | |
git push --follow-tags | |
echo pushed tags | |
echo "published=true" >> "$GITHUB_OUTPUT" | |
echo "tag=$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT" | |
release-notes: | |
name: Publish Release Notes | |
runs-on: ubuntu-latest | |
needs: changeset | |
if: needs.changeset.outputs.published == 'true' | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: # fetch-depth 0 is required so we can get the last tag and extract the changelog from the previous commit | |
fetch-depth: 0 | |
- name: Get previous tag | |
id: set-tags | |
run: | | |
echo "previous_tag=$(git describe --tags --abbrev=0 ${{ needs.changeset.outputs.tag }}^)" >> $GITHUB_OUTPUT | |
- name: Create release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | |
| # in this the RELEASE_NOTES are built line by line and +=$ syntax is used so that the \n newlines are correctly interpreted as newlines ratehr than string literals | |
BODY=$(git show HEAD -- CHANGELOG.md | grep '^+[^+]' | sed 's/^+//') | |
RELEASE_NOTES="## What's Changed" | |
RELEASE_NOTES+=$'\n'"${BODY}" | |
RELEASE_NOTES+=$'\n\n'"**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.set-tags.outputs.previous_tag }}...${{ needs.changeset.outputs.tag }}" | |
# Echo the tag and the formatted body for debugging purposes | |
echo "Tag: ${{ needs.changeset.outputs.tag }}" | |
echo "Previous Tag: ${{ steps.set-tags.outputs.previous_tag }}" | |
echo "Release Notes: ${RELEASE_NOTES}" | |
# Use the GitHub CLI (gh) to create a new release with the formatted release notes | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{ github.repository }}/releases \ | |
-f "tag_name=${{ needs.changeset.outputs.tag }}" \ | |
-f "name=${{ needs.changeset.outputs.tag }}" \ | |
-f "body=${RELEASE_NOTES}" \ | |
-F "draft=false" \ | |
-F "prerelease=false" \ | |
-F "generate_release_notes=false" |