Skip to content

Check release workflow #6188

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

Merged
Merged
Changes from all commits
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
44 changes: 25 additions & 19 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,47 @@ jobs:
check:
name: Check if release commit
runs-on: ubuntu-latest
outputs:
applicable: ${{ steps.check-commit-message.outputs.applicable }}
if: "startsWith(github.event.head_commit.message, 'release: ')"
steps:
- name: Check commit message
- name: Apply release-matching regexp to commit message
id: regex-match
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.event.head_commit.message }}
# Allow optional `v` prefix and GitHub PR reference suffix on first line only
# release: v1.2.3
# release: 1.2.3-beta.1
# release: v1.2.3-beta.1 (#9456)
regex: '^release: v?([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?)(\s+\(#[0-9]+\))?$'
flags: m

- name: Determine if applicable
id: check-commit-message
if: steps.regex-match.outputs.group1 != ''
run: |
str='${{ github.event.head_commit.message }}'
regex="^release\s*:\s*(v[0-9]+\.[0-9]+\.[0-9]+|[0-9]+\.[0-9]+\.[0-9]+)"
if [[ "$str" =~ $regex ]]; then
echo "::set-output name=applicable::true"
echo This is a release commit.
fi
echo "::set-output name=applicable::true"
echo "This is a release commit: ${{ steps.regex-match.outputs.group1 }}"
outputs:
applicable: ${{ steps.check-commit-message.outputs.applicable }}
version: ${{ steps.regex-match.outputs.group1 }}

release:
name: Create Tag and Draft Release
needs: check
if: needs.check.outputs.applicable == 'true'
permissions:
contents: write
name: Create Tag and Draft Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Calculate Tag and release names
- name: Calculate Tag and Release names
run: |
t=$(echo ${{ github.event.head_commit.message }} | sed -ne 's/.*\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p')
if [ -z "$t" ]; then
echo Malformed commit message; failed to extract semVer tag
return 1
fi
echo TAG_NAME="v${t}" >> $GITHUB_ENV
echo RELEASE_NAME="v${t} Release" >> $GITHUB_ENV
echo TAG_NAME="v${{ needs.check.outputs.version }}" >> $GITHUB_ENV
echo RELEASE_NAME="v${{ needs.check.outputs.version }} Release" >> $GITHUB_ENV

- name: Create and push Tag
run: |
Expand All @@ -62,7 +68,7 @@ jobs:

- name: Download release artifacts
run: |
#Wait 60m for all artifacts to be available
# Wait up to 60m for all artifacts to be available
retries=20
found=0
while [ $found -lt 10 -a $retries -gt 0 ]
Expand Down