Skip to content

Feat/7683/log analysis script to include fill time #177

Feat/7683/log analysis script to include fill time

Feat/7683/log analysis script to include fill time #177

Workflow file for this run

name: "Bump, Tag, and Release"
on:
workflow_dispatch:
inputs:
release_type:
description: "Select release type: patch, minor, or major"
required: true
type: choice
options:
- patch
- minor
- major
pull_request:
types:
- closed
permissions:
contents: write
pull-requests: write
jobs:
bump_and_pr:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: "Check out the repo"
uses: actions/checkout@v4.1.1
- name: "Install Bun"
uses: oven-sh/setup-bun@v2
- name: "Install Node.js dependencies"
run: bun install
- name: Import GPG Key
run: |
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
git config --global user.signingkey "$GPG_KEY_ID"
git config --global commit.gpgsign true
git config --global tag.gpgSign true
git config --global user.name "t1-bot"
git config --global user.email "engineering@t1protocol.com"
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
- name: Debug release_type input
run: |
echo "RELEASE TYPE: ${{ github.event.inputs.release_type }}"
- name: Compute next version
id: version
run: |
git fetch --tags
latest=$(git tag --sort=-v:refname | head -n 1 | sed 's/^v//')
echo "Latest tag: $latest"
IFS='.' read -r major minor patch <<< "$latest"
case "${{ github.event.inputs.release_type }}" in
major) major=$((major + 1)); minor=0; patch=0 ;;
minor) minor=$((minor + 1)); patch=0 ;;
patch) patch=$((patch + 1)) ;;
esac
new_version="${major}.${minor}.${patch}"
echo "Computed version: $new_version"
echo "new_version=$new_version" >> $GITHUB_OUTPUT
- name: Bump version files
run: |
npm run bump ${{ steps.version.outputs.new_version }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5.0.2
with:
token: ${{ secrets.GH_PAT }}
branch: release-bump-v${{ steps.version.outputs.new_version }}
title: "Chore: Bump version to v${{ steps.version.outputs.new_version }}"
body: |
This PR was automatically generated by the release workflow.
labels: automated, release
committer: t1-bot <engineering@t1protocol.com>
author: t1-bot <engineering@t1protocol.com>
base: canary
signoff: true
delete-branch: false
commit-message: "chore: bump version to v${{ steps.version.outputs.new_version }}"
assignees: diego-g
tag_and_release_notes:
if: |
github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.title, 'Chore: Bump version to v')
runs-on: ubuntu-latest
steps:
- name: Check out the repo at merge commit
uses: actions/checkout@v4.1.1
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
- name: Extract version from PR title
id: extract
run: |
VERSION=$(echo "${{ github.event.pull_request.title }}" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Import GPG Key
run: |
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
git config --global user.signingkey "$GPG_KEY_ID"
git config --global commit.gpgsign true
git config --global tag.gpgSign true
git config --global user.name "t1-bot"
git config --global user.email "engineering@t1protocol.com"
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
- name: Create Git tag
run: |
git tag -s ${{ steps.extract.outputs.version }} -m "Release ${{ steps.extract.outputs.version }}"
git push origin ${{ steps.extract.outputs.version }}
- name: Create GitHub Release with Notes
uses: release-drafter/release-drafter@v5
with:
tag: ${{ steps.extract.outputs.version }}
name: Release ${{ steps.extract.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}