feat: release automation #5
Workflow file for this run
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: | |
pull_request: | |
branches: | |
- main | |
env: | |
git-user: kubeshop-bot | |
git-email: [email protected] | |
base-branch: main | |
source-branch: develop | |
jobs: | |
create-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Sanitize version | |
run: | | |
VERSION=v0.0.0-test | |
echo "VERSION=$(echo "$VERSION" | sed "s/^v//")" >> "$GITHUB_ENV" | |
- name: Check out GitHub repo | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ env.source-branch }} | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "${{ env.git-user }}" | |
git config user.email "${{ env.git-email }}" | |
- name: Create release branch | |
run: git branch release/v${{ env.VERSION }} | |
- name: Push release branch | |
run: git push -f origin release/v${{ env.VERSION }} | |
- name: Build log | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "CHANGELOG<<$EOF" >> "$GITHUB_ENV" | |
echo "$(git --no-pager log "origin/main..HEAD" --pretty='format:|[**`%h`**](https://github.com/kubeshop/testkube-dashboard/commit/%h) | %s |' 2>&1 | sed 's/ (#\([0-9]*\))[^"]/|([#\1](https:\/\/github.com\/kubeshop\/testkube-dashboard\/pull\/\1))/g' | sed 's/Merge pull request #\([0-9]*\)\(.*\)/Merge pull request #\1\2 | ([#\1](https:\/\/github.com\/kubeshop\/testkube-dashboard\/pull\/\1))/')" >> "$GITHUB_ENV" | |
echo "$EOF" >> "$GITHUB_ENV" | |
echo "FULL_CHANGELOG<<$EOF" >> "$GITHUB_ENV" | |
echo "$(git --no-pager log "origin/main..HEAD" --pretty='format:|[**`%h`**](https://github.com/kubeshop/testkube-dashboard/commit/%h)| %ci | %an | %s |' 2>&1 | sed 's/ (#\([0-9]*\))[^"]/|([#\1](https:\/\/github.com\/kubeshop\/testkube-dashboard\/pull\/\1))/g' | sed 's/Merge pull request #\([0-9]*\)\(.*\)/Merge pull request #\1\2 | ([#\1](https:\/\/github.com\/kubeshop\/testkube-dashboard\/pull\/\1))/')" >> "$GITHUB_ENV" | |
echo "$EOF" >> "$GITHUB_ENV" | |
- name: Checkout base branch | |
run: git checkout ${{ env.base-branch }} | |
- name: Create PR | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
base: ${{ env.base-branch }} | |
branch: release/v${{ env.VERSION }} | |
title: Release v${{ env.VERSION }} | |
labels: | | |
release | |
automated pr | |
assignees: ${{ github.triggering_actor }} | |
body: | | |
### Changelog | |
| Commit | Description | PR | | |
|-|-|-| | |
${{env.CHANGELOG}} | |
<details> | |
<summary>Details</summary> | |
| Commit | Date | Author | Description | PR | | |
|-|-|-|-|-| | |
${{env.FULL_CHANGELOG}} | |
</details> |