Skip to content

Commit 4a08348

Browse files
author
Juli Ovechkina
authored
ci: add alpha workflow (#415)
1 parent b2c07fb commit 4a08348

File tree

2 files changed

+43
-10
lines changed

2 files changed

+43
-10
lines changed

.github/workflows/release-alpha.yml

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,43 @@ name: Release alpha version
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
manualPackageVersion:
7+
type: string
8+
required: false
9+
description: 'If your build failed and the version is already exists you can set version of package manually, e.g. 3.0.0-alpha.0. Use the prefix `alpha` otherwise you will get error.'
510

611
jobs:
712
build:
813
runs-on: ubuntu-latest
914
steps:
10-
- name: Extract branch name
11-
shell: bash
12-
run: |
13-
echo "branch_name=${GITHUB_REF#refs/heads/}"
14-
id: extract_branch
15-
- uses: gravity-ui/release-action@v1
15+
- run: |
16+
if [ "${{ github.event.inputs.manualPackageVersion }}" != "" ]; then
17+
if [[ "${{ github.event.inputs.manualPackageVersion }}" != *"alpha"* ]]; then
18+
echo "manualPackageVersion set incorrectly! Check that is contains alpha in it's name"
19+
exit 1
20+
fi
21+
fi
22+
- uses: actions/checkout@v2
23+
- uses: actions/setup-node@v1
1624
with:
17-
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
18-
npm-token: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }}
1925
node-version: 14
20-
npm-dist-tag: alpha
21-
default-branch: ${{ env.branch_name }}
26+
registry-url: 'https://registry.npmjs.org'
27+
- run: npm ci
28+
shell: bash
29+
- run: npm test
30+
shell: bash
31+
- name: Bump and commit version
32+
run: |
33+
echo ${{ github.event.inputs.manualPackageVersion }}
34+
35+
if [ "${{ github.event.inputs.manualPackageVersion }}" == "" ]; then
36+
npm version prerelease --preid=alpha --git-tag-version=false
37+
else
38+
npm version ${{ github.event.inputs.manualPackageVersion }} --git-tag-version=false
39+
fi
40+
- name: Publish version
41+
run: npm publish --tag alpha --access public
42+
env:
43+
NODE_AUTH_TOKEN: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }}
44+
shell: bash

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,16 @@ When you receive the approval of your pull-request from the code owners and pass
325325
4. Check your changes in CHANGELOG.md and approve robot's PR.
326326
5. Squash and merge PR. You can see release process on [the Actions tab](https://github.com/gravity-ui/page-constructor/actions).
327327

328+
### Alpha versions release
329+
330+
If you want to release alpha version of the package from your branch you can do it manually:
331+
332+
1. Go to tab Actions
333+
2. Select workflow "Release alpha version" on the left page's side
334+
3. You can see on the right side the button "Run workflow". Here you can choose the branch.
335+
4. You can also see field with manually version. If you release alpha in your branch for the first time, do not set anything here. After first release you have to set the new version manually because we don't change package.json in case that the branch can expire very soon. Use the prefix `alpha` in you manual version otherwise you will get error.
336+
5. Push "Run workflow" and wait until the action will finish. You can release versions as many as you want but do not abuse it and release versions if you really need it. In other cases use [npm pack](https://docs.npmjs.com/cli/v7/commands/npm-pack).
337+
328338
### Beta-major versions release
329339

330340
If you want to release a new major version, you will probably need for a beta versions before a stable one, please do the following:

0 commit comments

Comments
 (0)