Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra(release): draft release #2990

Merged
merged 6 commits into from
Jul 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Draft Release

on:
push:
branches:
- next

permissions:
contents: write # to create releases

jobs:
draft_release:
if: startsWith(github.event.head_commit.message, 'chore(release):')
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0 # we need the tags and the commit history for the gh release create command

- name: Extract release version
run: |
RELEASE_VERSION=$(echo "${{ github.event.head_commit.message }}" | sed 's/.*\: //')
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved
echo "RELEASE_VERSION=$RELEASE_VERSION"
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
PREVIOUS_VERSION=$(git describe --tags --abbrev=0)
echo "PREVIOUS_VERSION=$PREVIOUS_VERSION"
echo "PREVIOUS_VERSION=$PREVIOUS_VERSION" >> $GITHUB_ENV

- name: Release Args - Prerelease
if: contains(github.event.head_commit.message, '-')
run: |
RELEASE_ARGS="--prerelease"
echo "RELEASE_ARGS=$RELEASE_ARGS"
echo "RELEASE_ARGS=$RELEASE_ARGS" >> $GITHUB_ENV

- name: Release Args - Release
if: "!contains(github.event.head_commit.message, '-')"
run: |
RELEASE_ARGS="--latest"
echo "RELEASE_ARGS=$RELEASE_ARGS"
echo "RELEASE_ARGS=$RELEASE_ARGS" >> $GITHUB_ENV

- name: Create draft release
run: |
gh release create \
v$RELEASE_VERSION \
--draft \
$RELEASE_ARGS \
--generate-notes \
--notes-start-tag $PREVIOUS_VERSION \
--title v$RELEASE_VERSION
env:
GH_TOKEN: ${{ github.token }}