Skip to content

Commit

Permalink
chore(ci): add manual workflow for release (#1384)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin committed Feb 14, 2022
1 parent 3f0024e commit cf21467
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Create release

on:
workflow_dispatch:
inputs:
mode:
type: choice
description: release type
required: true
default: 'minor'
options:
- patch
- minor
- major

jobs:
run-release:
name: Run release
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Fetch from origin repo
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.TINKOFF_BOT_PAT }}

- name: Setup Node.js and Cache
uses: ./.github/actions/nodejs

- name: Run release
id: run-release
run: |
git config user.name "tinkoff-bot"
git config --global push.followTags true
npm run release -- --release-as ${{ github.event.inputs.mode }}
npm run prettier
git add .
git commit -m 'chore: run prettier' --no-verify
echo "::set-output name=new_version::$(node -p "require('./package.json').version")"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.TINKOFF_BOT_PAT }}
branch: release/${{ steps.run-release.outputs.new_version }}
title: 'Release/${{ steps.run-release.outputs.new_version }}'

concurrency:
group: create-release-${{ github.head_ref }}
cancel-in-progress: true
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Release Taiga UI packages

on:
push:
pull_request:
types: [labeled]
branches:
- 'release/**'

Expand All @@ -12,6 +13,7 @@ env:

jobs:
build:
if: ${{ github.event.label.name == 'ready to merge' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 4 additions & 2 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ execSync(`git checkout -b release/${newVersion}`, options);
execSync(`npm run release -- --release-as ${mode}`, options);

execSync(`npm run prettier`, options);
execSync(`git add . && git commit --all --amend --no-edit --no-verify`, options);
execSync(`git commit -m 'chore: run prettier' --no-verify`);

checkChangelog().then(() => {
execSync(`git add . && git commit --all --amend --no-edit --no-verify`, options);
execSync(
`git commit -m 'chore(changelog): fix incorrect generated logs' --no-verify`,
);
execSync(`git push --set-upstream origin release/${newVersion}`, options);
execSync(`git push --tags`, options);
});
Expand Down

0 comments on commit cf21467

Please sign in to comment.