Skip to content

Commit

Permalink
feat: try a merge to main w/ backport strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney committed Nov 22, 2023
1 parent 07f2b06 commit cf996f4
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:
# - cron: "0 8 * * *" # daily at 8am, but how to specify branch name?
push:
branches:
- "main"
- "release-[0-9].[0-9].x"
- "k[0-9]*"

permissions:
contents: write
pull-requests: write
issues: write

jobs:
release:
Expand All @@ -34,22 +34,44 @@ jobs:
id: release
with:
command: manifest
default-branch: "${{ steps.extract_branch.outputs.branch }}"
- name: Upload Release Artifact
default-branch: main
- name: tag PR with backport tag
shell: bash
env:
BRANCH: "${{ steps.extract_branch.outputs.branch }}"
run:
prNumber=$(echo ${{ steps.release.outputs.pr }} | jq -r .number)
gh pr edit $prNumber --tag "backport $BRANCH"
- name: upload release artifacts
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ steps.release.outputs.tag_name }} ./dist/build.txt
- name: create release branch from k release
if: ${{ startsWith(steps.extract_branch.outputs.branch, 'k') && steps.release.outputs.release_created }}
id: update_release_config
run: |
branch=release-${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.x
git checkout -b $branch
mv release-please-config.json tmp.json
jq '.versioning = "always-bump-patch"' tmp.json > release-please-config.json
rm tmp.json
git add release-please-config.json
git commit -m 'chore: release branch config bumps patch'
git push -u origin
# TODO: announce in #loki-releases if release created
- uses: stefanzweifel/git-auto-commit-action@v5
if: ${{ steps.update_release_config.outcome == 'success' }}
id: create_release_branch
with:
commit_message: "chore: release branch bumps patch on release"
branch: release-${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.x
file_pattern: "release-please-config.json"
create_branch: true
- if: ${{ steps.create_release_branch.outcome == 'success' }}
id: created_branch_message
env:
BRANCH: release-${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.x
shell: bash
run: |
prNumber=$(echo ${{ steps.release.outputs.pr }} | jq -r .number)
gh pr comment $prNumber --body "created release branch [$BRANCH](https://github.com/grafana/loki-release/tree/$BRANCH)"
# TODO: announce in #loki-releases if release created

0 comments on commit cf996f4

Please sign in to comment.