Files
trezor-suite/.github/workflows/release-connect-init.yml

73 lines
2.3 KiB
YAML

name: "[Release] connect create release branch"
permissions:
id-token: write # for fetching the OIDC token
contents: read # for actions/checkout
on:
workflow_dispatch:
inputs:
commit_sha:
description: "The commit SHA to checkout"
required: true
type: string
jobs:
# Version should have been bumped by now thanks to ./scripts/ci/connect-release-init-npm.js
extract-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags.
fetch-depth: 0
# Checkout the specified commit
ref: ${{ github.event.inputs.commit_sha }}
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Extract connect version
id: set-version
run: echo "version=$(node ./scripts/ci/get-connect-version.js)" >> $GITHUB_OUTPUT
create-push-release-branch:
needs: [extract-version]
name: "Create release branch for version ${{ needs.extract-version.outputs.version }}"
runs-on: ubuntu-latest
outputs:
branch_name: ${{ steps.push-branch.outputs.branch_name }}
steps:
- name: Generate GitHub App token
id: trezor-bot-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.TREZOR_BOT_APP_ID }}
private-key: ${{ secrets.TREZOR_BOT_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
# Ensure the full commit history is available is required to get specific `ref`.
fetch-depth: 0
# Checkout the specified commit
ref: ${{ github.event.inputs.commit_sha }}
token: ${{ steps.trezor-bot-token.outputs.token }}
- name: Setup Git config
run: |
git config --global user.name "trezor-ci"
git config --global user.email "${{ secrets.TREZOR_BOT_EMAIL }}"
- name: Create and push new branch
env:
BRANCH_NAME: "release/connect/${{ needs.extract-version.outputs.version }}"
run: |
echo ${{ env.BRANCH_NAME }}
git checkout -b ${{ env.BRANCH_NAME }}
git push origin ${{ env.BRANCH_NAME }}