Skip to content

Commit fa5c3fd

Browse files
author
sozinov
committed
WMSDK-442: change publish workflows
1 parent 1ba10bd commit fa5c3fd

11 files changed

Lines changed: 156 additions & 40 deletions

.github/workflows/distribute.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/pr-description-validate.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ on:
99
jobs:
1010
check-description:
1111
runs-on: ubuntu-latest
12-
12+
if: ${{ github.event_name == 'pull_request' || github.event.issue.pull_request }}
1313
steps:
1414
- name: Check out the repository
1515
uses: actions/checkout@v4
16-
16+
1717
- name: Check PR description
1818
id: validate_description_step
1919
uses: actions/github-script@v7
@@ -23,7 +23,7 @@ jobs:
2323
const pr = context.payload.pull_request;
2424
if (!pr || !pr.body || pr.body.trim().length === 0) {
2525
core.setOutput('pr_description_check_passed', 'false');
26-
}
26+
}
2727
else {
2828
core.setOutput('pr_description_check_passed', 'true');
2929
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: SDK publish manual
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
check-branch:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check if branch matches pattern
11+
run: |
12+
if ! echo "${{ github.ref_name }}" | grep -q "release/.*-rc"; then
13+
echo "Branch name must match pattern 'release/*-rc' (e.g. release/2.13.2-rc)"
14+
exit 1
15+
fi
16+
17+
call-publish-reusable:
18+
needs: check-branch
19+
uses: ./.github/workflows/publish-reusable.yml
20+
with:
21+
branch: ${{ github.ref_name }}
22+
secrets: inherit
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: SDK publish RN master and support
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- 'master'
8+
- 'support/*'
9+
10+
jobs:
11+
call-reusable:
12+
if: ${{ github.event.pull_request.merged == true }}
13+
uses: ./.github/workflows/publish-reusable.yml
14+
with:
15+
branch: ${{ github.base_ref }}
16+
secrets: inherit
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
name: Release to NPM
22

33
on:
4-
pull_request:
5-
types: [closed]
6-
branches:
7-
- master
4+
workflow_call:
5+
inputs:
6+
branch:
7+
required: true
8+
type: string
89

910
jobs:
1011
checkingVersion:
1112
name: Checking version
12-
if: github.event.pull_request.merged
1313
runs-on: ubuntu-latest
1414
outputs:
1515
isRunable: ${{ fromJson(steps.package.outputs.content).version != fromJson(steps.package.outputs.content).target-version }}
1616
newVersion: ${{ fromJson(steps.package.outputs.content).target-version }}
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v4
20+
with:
21+
ref: ${{ inputs.branch }}
2022
- name: Read package.json
2123
id: package
2224
uses: juliangruber/read-file-action@v1
@@ -36,6 +38,8 @@ jobs:
3638
steps:
3739
- name: Checkout
3840
uses: actions/checkout@v4
41+
with:
42+
ref: ${{ inputs.branch }}
3943
- name: Setup node JS
4044
uses: actions/setup-node@v2
4145
with:
@@ -54,6 +58,8 @@ jobs:
5458
steps:
5559
- name: Checkout
5660
uses: actions/checkout@v4
61+
with:
62+
ref: ${{ inputs.branch }}
5763
- name: Setup node JS
5864
uses: actions/setup-node@v2
5965
with:
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: release-version-check
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize]
6+
branches:
7+
- master
8+
- develop
9+
10+
jobs:
11+
check-rc-pattern:
12+
runs-on: ubuntu-latest
13+
if: startsWith(github.head_ref, 'release')
14+
steps:
15+
- name: Check RC pattern
16+
run: |
17+
if [[ "${{ github.head_ref }}" =~ release/[0-9]+\.[0-9]+\.[0-9]+-rc ]]; then
18+
echo "Branch name contains release/version-rc pattern. Merging is not allowed. Only stable release should be merge into master"
19+
exit 1
20+
fi
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
24+
check-master-version:
25+
needs: check-rc-pattern
26+
runs-on: ubuntu-latest
27+
if: github.base_ref == 'master' && startsWith(github.head_ref, 'release')
28+
steps:
29+
- name: Checkout master branch
30+
uses: actions/checkout@v4
31+
with:
32+
ref: master
33+
path: master
34+
- name: Checkout release branch
35+
uses: actions/checkout@v4
36+
with:
37+
ref: ${{ github.head_ref }}
38+
path: release
39+
- name: Extract versions
40+
run: |
41+
MASTER_VERSION=$(grep 'target-version' master/package.json | awk '{print $2}' | tr -d '",')
42+
RELEASE_VERSION=$(grep 'target-version' release/package.json | awk '{print $2}' | tr -d '",')
43+
echo "MASTER_VERSION=$MASTER_VERSION" >> $GITHUB_ENV
44+
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
45+
- name: Compare versions
46+
uses: jackbilestech/semver-compare@1.0.4
47+
with:
48+
head: ${{ env.RELEASE_VERSION }}
49+
base: ${{ env.MASTER_VERSION }}
50+
operator: '>'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Build application after merge into develop
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- 'develop'
8+
9+
jobs:
10+
call-reusable:
11+
if: ${{ github.event.pull_request.merged == true }}
12+
uses: ./.github/workflows/trigger-build-app-reusable.yml
13+
with:
14+
branch: ${{ github.base_ref }}
15+
secrets: inherit
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Build application manual
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
call-reusable:
8+
uses: ./.github/workflows/trigger-build-app-reusable.yml
9+
with:
10+
branch: ${{ github.ref_name }}
11+
secrets: inherit
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Build application when create PR into master/support/mission
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- support/*
8+
- mission/*
9+
types:
10+
- opened
11+
- synchronize
12+
13+
jobs:
14+
call-reusable:
15+
if: ${{ startsWith(github.event.pull_request.head.ref, 'release/') }}
16+
uses: ./.github/workflows/trigger-build-app-reusable.yml
17+
with:
18+
branch: ${{ github.event.pull_request.head.ref }}
19+
secrets: inherit

0 commit comments

Comments
 (0)