Skip to content

Release

Release #18

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
noIncrement:
description: "Создать релиз без увеличения версии и публикации в npm"
required: false
default: false
type: boolean
bumpMode:
description:
"Режим обновления версии. auto - автоматически на основе списка
изменений, major - увеличение мажорной версии, minor - увеличение
минорной версии, patch - выпуск патча"
required: false
default: auto
type: choice
options:
- auto
- major
- minor
- patch
beta:
description: "Создать beta-релиз"
required: false
default: false
type: boolean
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
check-permissions:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
steps:
- name: Check Main Branch
if: github.ref != 'refs/heads/main'
run: |
echo "❌ Этот workflow может быть запущен только на основной ветке (main)"
exit 1
- name: Verify Release Team
run: |
if ! gh api "orgs/cdek-it/teams/react-native-release/memberships/$GITHUB_ACTOR" --silent 2>/dev/null; then
echo "❌ Этот workflow может быть запущен только участниками команды release"
exit 1
fi
install:
runs-on: ubuntu-latest
needs: check-permissions
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-node
test:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/tests
lint:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/lint
typecheck:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/typecheck
commitlint:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/commitlint
release:
runs-on: ubuntu-latest
needs: [test, lint, typecheck, commitlint]
permissions:
contents: write
id-token: write # REQUIRED FOR OIDC
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
ssh-key: ${{ secrets.SELF_DEPLOY_KEY }}
- uses: ./.github/actions/setup-node
- name: Configure Git
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Release with Increment and Publishing
if: inputs.noIncrement == false && inputs.bumpMode == 'auto'
run: |
if [ "${{ inputs.beta }}" == "true" ]; then
yarn release --preRelease=beta
else
yarn release
fi
- name: Release with Increment as ${{ inputs.bumpMode }} and Publishing
if: inputs.noIncrement == false && inputs.bumpMode != 'auto'
run: |
if [ "${{ inputs.beta }}" == "true" ]; then
yarn release ${{ inputs.bumpMode }} --preRelease=beta
else
yarn release ${{ inputs.bumpMode }}
fi
- name: Release Without Increment and Publishing
if: inputs.noIncrement == true
run: |
if [ "${{ inputs.beta }}" == "true" ]; then
yarn release --no-increment --no-npm.publish --preRelease=beta
else
yarn release --no-increment --no-npm.publish
fi
- name: Send Notification
run: |
PACKAGE_NAME=$(jq -r ".name" package.json)
PACKAGE_VERSION=$(jq -r ".version" package.json)
REPO_URL="${{ github.server_url }}/${{ github.repository }}"
MESSAGE="Выпущена новая версия [${PACKAGE_NAME}](${REPO_URL})\n[v${PACKAGE_VERSION}](${REPO_URL}/releases/tag/v${PACKAGE_VERSION})"
curl -X POST -H "Content-Type: application/json" -d "{\"text\": \"$MESSAGE\"}" "${{ secrets.BUILD_CHAT_WEBHOOK }}"