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
TCN-875 Various bugs in release action #86
Merged
elliotmjackson
merged 1 commit into
main
from
ejackson/tcn-875-various-bugs-in-buf-setup-action-release
Dec 12, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,22 @@ on: | |
type: string | ||
description: The version you intend to release (eg x.y.z) | ||
required: true | ||
pull_request: | ||
types: [ closed ] | ||
push: | ||
branches: | ||
- 'release/**' | ||
tags: | ||
- v* | ||
|
||
env: | ||
VERSION: v${{ github.event.inputs.version }} | ||
VERSION: ${{ github.event.inputs.version }} | ||
APP_ID: 257262 | ||
|
||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }} | ||
steps: | ||
- name: Generate token | ||
id: generate_token | ||
|
@@ -35,14 +43,15 @@ jobs: | |
run: make updateversion VERSION=${{env.VERSION}} | ||
- name: Create PR | ||
id: cpr | ||
uses: peter-evans/create-pull-request@ad43dccb4d726ca8514126628bec209b8354b6dd | ||
uses: peter-evans/create-pull-request@331d02c7e2104af23ad5974d4d5cbc58a3e6dc77 | ||
with: | ||
add-paths: . | ||
commit-message: "Update version to ${{env.VERSION}}" | ||
branch: release/${{env.VERSION}} | ||
commit-message: "Update version to v${{env.VERSION}}" | ||
branch: release/v${{env.VERSION}} | ||
delete-branch: true | ||
title: "Release ${{env.VERSION}}" | ||
body: Release prepared for ${{env.VERSION}} | ||
title: "Release v${{env.VERSION}}" | ||
body: | | ||
Release prepared for ${{env.VERSION}} | ||
token: ${{ steps.generate_token.outputs.token }} | ||
tag: | ||
runs-on: ubuntu-latest | ||
|
@@ -66,10 +75,39 @@ jobs: | |
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
fetch-depth: 0 | ||
- name: Tag Release | ||
- name: Tag | ||
run: | | ||
git config --global user.password ${{ steps.generate_token.outputs.token }} | ||
git tag -d ${{env.VERSION}} 2> /dev/null || echo 'local ref does not exist' | ||
git push origin :${{env.VERSION}} 2> /dev/null || echo 'remote ref does not exist' | ||
git tag ${{env.VERSION}} | ||
git push origin ${{env.VERSION}} | ||
release: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} | ||
steps: | ||
- name: Generate token | ||
id: generate_token | ||
uses: tibdex/github-app-token@v1 | ||
with: | ||
app_id: ${{env.APP_ID}} | ||
private_key: ${{ secrets.TOKEN_EXCHANGE_GH_APP_PRIVATE_KEY }} | ||
repository: ${{ github.repository }} | ||
permissions: >- | ||
{"contents": "write"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one does not, the one you reference is OP |
||
- name: Checkout repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
fetch-depth: 0 | ||
- name: Sync v1 branch | ||
run: | | ||
git fetch origin | ||
git switch v1 | ||
git merge main | ||
git push origin v1 | ||
- name: Release | ||
id: ghr | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't these
v
s be doubled? (I realize this looks a lot like https://github.com/bufbuild/buf/blob/main/.github/workflows/release.yaml so maybe not?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these will not, the input should be x.y.z without any v, even though that is not enforced at this stage 😂