Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions .github/workflows/build.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/distribute.yml

This file was deleted.

18 changes: 9 additions & 9 deletions .github/workflows/gitleaks-secrets-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
name: gitleaks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run Gitleaks
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.MINDBOX_GITLEAKS_LICENSE }}
- name: Run Gitleaks
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.MINDBOX_GITLEAKS_LICENSE }}
46 changes: 46 additions & 0 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: RN SDK CI

on:
pull_request:
types: [ opened, synchronize ]
branches:
- develop
paths-ignore:
- '**.md'

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup node JS
uses: actions/setup-node@v2
with:
node-version: 14
registry-url: https://registry.npmjs.org

- name: Setup local environment
run: yarn

- name: Run unit tests
run: yarn test

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup node JS
uses: actions/setup-node@v2
with:
node-version: 14
registry-url: https://registry.npmjs.org

- name: Setup local environment
run: yarn

- name: Run linting
run: yarn lint
10 changes: 5 additions & 5 deletions .github/workflows/pr-description-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ name: Validate PR description is not empty

on:
pull_request:
types: [opened, edited, reopened, synchronize]
types: [ opened, edited, reopened, synchronize ]
issue_comment:
types: [created]
types: [ created ]

jobs:
check-description:
runs-on: ubuntu-latest

if: ${{ github.event_name == 'pull_request' || github.event.issue.pull_request }}
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Check PR description
id: validate_description_step
uses: actions/github-script@v7
Expand All @@ -23,7 +23,7 @@ jobs:
const pr = context.payload.pull_request;
if (!pr || !pr.body || pr.body.trim().length === 0) {
core.setOutput('pr_description_check_passed', 'false');
}
}
else {
core.setOutput('pr_description_check_passed', 'true');
}
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/publish-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: SDK publish manual

on:
workflow_dispatch:

jobs:
check-branch:
runs-on: ubuntu-latest
steps:
- name: Check if branch matches pattern
run: |
if ! echo "${{ github.ref_name }}" | grep -q "release/.*-rc"; then
echo "Branch name must match pattern 'release/*-rc' (e.g. release/2.13.2-rc)"
exit 1
fi

call-publish-reusable:
needs: check-branch
uses: ./.github/workflows/publish-reusable.yml
with:
branch: ${{ github.ref_name }}
secrets: inherit
16 changes: 16 additions & 0 deletions .github/workflows/publish-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: SDK publish from master or support branch

on:
pull_request:
types: [ closed ]
branches:
- 'master'
- 'support/*'

jobs:
call-reusable:
if: ${{ github.event.pull_request.merged == true }}
uses: ./.github/workflows/publish-reusable.yml
with:
branch: ${{ github.base_ref }}
secrets: inherit
113 changes: 113 additions & 0 deletions .github/workflows/publish-reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: SDK publish

on:
workflow_call:
inputs:
branch:
required: true
type: string

jobs:
checkingVersion:
name: Checking version
runs-on: ubuntu-latest
outputs:
isRunable: ${{ fromJson(steps.package.outputs.content).version != fromJson(steps.package.outputs.content).target-version }}
newVersion: ${{ fromJson(steps.package.outputs.content).target-version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Read package.json
id: package
uses: juliangruber/read-file-action@v1
with:
path: ./package.json
- name: Version check
if: ${{ fromJson(steps.package.outputs.content).version == fromJson(steps.package.outputs.content).target-version }}
uses: actions/github-script@v6
with:
script: |
core.setFailed('Packet version and target version are equivalent!')
testing:
name: Testing
needs: [ checkingVersion ]
if: needs.checkingVersion.outputs.isRunable == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Setup node JS
uses: actions/setup-node@v2
with:
node-version: 14
registry-url: https://registry.npmjs.org
- name: Setup local environment
run: yarn
- name: Run tests
run: yarn test

releasing:
name: Releasing
needs: [ checkingVersion, testing ]
if: needs.checkingVersion.outputs.isRunable == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Setup node JS
uses: actions/setup-node@v2
with:
node-version: 14
registry-url: https://registry.npmjs.org
- name: Setup GIT
run: |
git config user.email '$GITHUB_ACTOR@users.noreply.github.com'
git config user.name '$GITHUB_ACTOR'
- name: Setup local environment
run: yarn
- name: Determine Pre-Release Status
run: |
VERSION=${{ needs.checkingVersion.outputs.newVersion }}
if [[ "$VERSION" == *"rc"* ]]; then
echo "::set-output name=is_prerelease::true"
else
echo "::set-output name=is_prerelease::false"
fi
- name: Release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_CICD_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ ${{ steps.prerelease_check.outputs.is_prerelease }} == "true" ]; then
yarn release ${{ needs.checkingVersion.outputs.newVersion }} --pre-release --no-plugins.@release-it/keep-a-changelog.strictLatest --ci
else
yarn release ${{ needs.checkingVersion.outputs.newVersion }} --no-plugins.@release-it/keep-a-changelog.strictLatest --ci
fi

merge:
needs: [ releasing ]
if: |
startsWith(github.head_ref, 'release') &&
github.base_ref == 'master'
runs-on: ubuntu-latest
steps:
- name: Checkout develop branch
uses: actions/checkout@v4
with:
ref: develop
- name: Create Pull Request
run: gh pr create --base develop --head master --title "Merge 'master' into 'develop' after release" --body "Automated Pull Request to merge 'master' into 'develop' after release"
env:
GITHUB_TOKEN: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }}
- name: Merge Pull Request
run: |
pr_number=$(gh pr list --base develop --head master --json number --jq '.[0].number')
gh pr merge $pr_number --merge --auto
env:
GITHUB_TOKEN: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }}
50 changes: 50 additions & 0 deletions .github/workflows/release-version-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: release-version-check

on:
pull_request:
types: [ opened, edited, synchronize ]
branches:
- master
- develop

jobs:
check-rc-pattern:
runs-on: ubuntu-latest
if: startsWith(github.head_ref, 'release')
steps:
- name: Check RC pattern
run: |
if [[ "${{ github.head_ref }}" =~ release/[0-9]+\.[0-9]+\.[0-9]+-rc ]]; then
echo "Branch name contains release/version-rc pattern. Merging is not allowed. Only stable release should be merge into master"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

check-master-version:
needs: check-rc-pattern
runs-on: ubuntu-latest
if: github.base_ref == 'master' && startsWith(github.head_ref, 'release')
steps:
- name: Checkout master branch
uses: actions/checkout@v4
with:
ref: master
path: master
- name: Checkout release branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
path: release
- name: Extract versions
run: |
MASTER_VERSION=$(grep 'target-version' master/package.json | awk '{print $2}' | tr -d '",')
RELEASE_VERSION=$(grep 'target-version' release/package.json | awk '{print $2}' | tr -d '",')
echo "MASTER_VERSION=$MASTER_VERSION" >> $GITHUB_ENV
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Compare versions
uses: jackbilestech/semver-compare@1.0.4
with:
head: ${{ env.RELEASE_VERSION }}
base: ${{ env.MASTER_VERSION }}
operator: '>'
Loading