CLI Bottle (update) #14
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: "CLI Bottle (update)" | |
on: | |
workflow_dispatch: | |
inputs: | |
userVersion: | |
description: 'Package Version (leave empty for latest release)' | |
required: false | |
type: "string" | |
default: "" | |
workflow_call: | |
inputs: | |
callerVersion: | |
description: 'Package Version (leave empty for latest release)' | |
required: false | |
type: "string" | |
default: "" | |
jobs: | |
update-bottle: | |
runs-on: ubuntu-latest | |
steps: | |
# Because called actions run in caller repository, we have to be explicit here. | |
- uses: actions/checkout@v3 | |
with: | |
repository: trinsic-id/homebrew-tap | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- name: Configure git credentials | |
uses: OleksiyRudenko/gha-git-credentials@v2 | |
with: | |
token: '${{ secrets.GITHUB_TOKEN }}' | |
- uses: trinsic-id/set-version@main | |
id: setversion | |
with: | |
githubToken: ${{ secrets.API_GITHUB_TOKEN }} | |
overrideVersion: ${{ inputs.userVersion || inputs.callerVersion }} | |
overrideRepository: trinsic-id/sdk | |
- run: .github/workflows/update-formula.ps1 -ReleaseVersion ${{ steps.setversion.outputs.releaseVersion }} -Version ${{ steps.setversion.outputs.packageVersion }} | |
shell: pwsh | |
- name: Create new branch name | |
id: new-branch-name | |
run: | | |
echo "newbranchname=mewmba-${{ github.head_ref || github.ref_name }}-generated-protos" >> $env:GITHUB_OUTPUT | |
echo "oldbranchname=${{ github.head_ref || github.ref_name }}" >> $env:GITHUB_OUTPUT | |
shell: pwsh | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
id: commit_changes | |
with: | |
author_name: Mewmba | |
author_email: mewmba@trinsic.id | |
message: 'trinsic-cli ${{ steps.setversion.outputs.releaseVersion }}' | |
new_branch: ${{ steps.new-branch-name.outputs.newbranchname }} | |
push: '--force --set-upstream origin ${{ steps.new-branch-name.outputs.newbranchname }}' | |
- name: pull-request | |
uses: repo-sync/pull-request@v2 | |
if: ${{ steps.commit_changes.outputs.committed == 'true' }} | |
with: | |
source_branch: ${{ steps.new-branch-name.outputs.newbranchname }} | |
destination_branch: ${{ steps.new-branch-name.outputs.oldbranchname }} | |
pr_title: 'trinsic-cli ${{ steps.setversion.outputs.releaseVersion }}' # PR title must equal commit message | |
pr_allow_empty: false | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |