Skip to content

Commit

Permalink
feat: add relase and release-preview workflows
Browse files Browse the repository at this point in the history
Signed-off-by: davidko <[email protected]>
  • Loading branch information
innobead committed Jan 31, 2024
1 parent 1772c33 commit 15fb203
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 4 deletions.
171 changes: 171 additions & 0 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: Release - Preview

on:
workflow_dispatch:
inputs:
branch_tag:
description: "Branch:Tag:Milestone:PreviousTag, ex: v1.6.x:v1.6.0-rc1:v1.6.0:v1.5.0"
required: true

defaults:
run:
shell: bash

env:
CARGO_TERM_COLOR: always

jobs:
release:
runs-on: ubuntu-latest

env:
GITHUB_TOKEN: ${{ secrets.GH_ACTION_TOKEN }}

permissions:
contents: write
pull-requests: write

steps:
- name: Setup Git
run: |
gh auth setup-git
- run: |
git config --global user.email "[email protected]"
git config --global user.name "David Ko"
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: innobead/renote
ref: main
path: renote
- run: cargo install --path ./renote

- id: var
name: Get branch, tag, milestone
run: |
IFS=':' read -ra tokens <<< "${{ inputs.branch_tag }}"
branch="${tokens[0]}"
tag="${tokens[1]}"
milestone="${tokens[2]}"
prev_tag="${tokens[3]:-}"
if [ -z "${tokens[0]}" || -z "${tokens[1]}" || -z "${tokens[2]}" ]; then
echo "Branch, Tag or Milestone is empty"
exit 1
fi
echo "branch=${branch}" >> $GITHUB_OUTPUT
echo "tag=${tag}" >> $GITHUB_OUTPUT
echo "milestone=${milestone}" >> $GITHUB_OUTPUT
echo "prev_tag=${prev_tag}" >> $GITHUB_OUTPUT
cat <<EOF
branch=${branch}
tag=${tag}
milestone=${milestone}
prev_tag=${prev_tag}
EOF
- id: pr
name: Create a release PR (for updating the version file)
run: |
renote pr \
--owner longhorn \
--repo longhorn \
--branch ${{ steps.var.outputs.branch }} \
--tag ${{ steps.var.outputs.tag }} \
--longhorn-chart-repo charts \
--longhorn-repos longhorn-manager \
--longhorn-repos longhorn-engine \
--longhorn-repos longhorn-instance-manager \
--longhorn-repos longhorn-share-manager \
--longhorn-repos backing-image-manager \
--longhorn-repos longhorn-ui \
--merge
- id: artifact
name: Collect artifacts
run: |
./scripts/collect-artifacts.sh longhorn charts
- id: tag
name: Create a tag for each release repo
run: |
renote tag \
--owner longhorn \
--branch ${{ steps.var.outputs.branch }} \
--tag ${{ steps.var.outputs.tag }} \
--create-version-file \
--version-file-repos longhorn-manager \
--version-file-repos longhorn-engine \
--version-file-repos longhorn-instance-manager \
--version-file-repos longhorn-share-manager \
--version-file-repos backing-image-manager \
--version-file-repos longhorn-ui \
--repos longhorn \
--force
- id: changelog
name: Create a changelog from the last release
run: |
output=$(renote changelog \
--owner longhorn \
--branch ${{ steps.var.outputs.branch }} \
--tag ${{ steps.var.outputs.tag }} \
--prev-tag ${{ steps.var.outputs.prev_tag }} \
--repos longhorn-manager \
--repos longhorn-engine \
--repos longhorn-instance-manager \
--repos longhorn-share-manager \
--repos backing-image-manager \
--repos longhorn-ui \
--repos longhorn)
echo "$output"
echo "$output" > ./changelog.md
- id: release
name: Create a release
run: |
renote release \
--owner longhorn \
--repo longhorn \
--branch ${{ steps.var.outputs.branch }} \
--tag ${{ steps.var.outputs.tag }} \
--milestone ${{ steps.var.outputs.milestone }} \
--pre-note ./assets/release-preview/pre-note.md \
--note-contributors innobead \
--since-days 365 \
--exclude-labels "kind/backport" \
--exclude-labels "kind/test" \
--exclude-labels "area/infra" \
--exclude-labels "area/ci" \
--exclude-labels "area/qa" \
--exclude-labels "wontfix" \
--exclude-labels "duplicated" \
--exclude-labels "invalid" \
--exclude-labels "release/task" \
--note-section-labels "highlight" \
--note-section-labels "kind/feature" \
--note-section-labels "kind/improvement" \
--note-section-labels "kind/bug" \
--note-section-labels "area/performance" \
--note-section-labels "area/resilience" \
--note-section-labels "area/stability" \
--note-section-labels "area/scalability" \
--note-section-labels "area/benchmark" \
--pre-hook ./scripts/check-images-ready.sh \
--pre-hook-args "longhornio/longhorn-manager:${{ steps.var.outputs.tag }}" \
--pre-hook-args "longhornio/longhorn-engine:${{ steps.var.outputs.tag }}" \
--pre-hook-args "longhornio/longhorn-instance-manager:${{ steps.var.outputs.tag }}" \
--pre-hook-args "longhornio/longhorn-share-manager:${{ steps.var.outputs.tag }}" \
--pre-hook-args "longhornio/backing-image-manager:${{ steps.var.outputs.tag }}" \
--pre-hook-args "longhornio/longhorn-ui:${{ steps.var.outputs.tag }}" \
--artifacts ./longhorn.yaml \
--artifacts ./longhorn-images.txt \
--artifacts ./charts.tar.gz \
--artifacts ./changelog.md \
--pre-release \
--draft
5 changes: 1 addition & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ jobs:
--longhorn-repos longhorn-instance-manager \
--longhorn-repos longhorn-share-manager \
--longhorn-repos backing-image-manager \
--longhorn-repos longhorn-ui \
--merge
--longhorn-repos longhorn-ui
- id: artifact
name: Collect artifacts
Expand All @@ -104,7 +103,6 @@ jobs:
--version-file-repos longhorn-share-manager \
--version-file-repos backing-image-manager \
--version-file-repos longhorn-ui \
--repos longhorn \
--force
- id: changelog
Expand All @@ -113,7 +111,6 @@ jobs:
output=$(renote changelog \
--owner longhorn \
--branch ${{ steps.var.outputs.branch }} \
--tag ${{ steps.var.outputs.tag }} \
--prev-tag ${{ steps.var.outputs.prev_tag }} \
--repos longhorn-manager \
--repos longhorn-engine \
Expand Down
1 change: 1 addition & 0 deletions assets/release-preview/post-note.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Changes in this release
3 changes: 3 additions & 0 deletions assets/release-preview/pre-note.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> **DON'T UPGRADE from/to any RC/Preview/Sprint releases because the operation is not supported.**
## Resolved Issues in this release

0 comments on commit 15fb203

Please sign in to comment.