Skip to content

Commit

Permalink
[RN][GHA] Migrate the Prepare Release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cipolleschi committed Jun 7, 2024
1 parent f57d624 commit 193de8b
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/actions/prepare_release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: prepare_release
description: Prepare React Native release
runs:
using: composite
steps:
- name: Yarn Install
shell: bash
run: yarn install --non-interactive
- name: Versioning workspace packages
shell: bash
run: |
node scripts/releases/set-version "${{ inputs.version }}"
- name: Creating Release commit
shell: bash
run: |
git commit -a -m "Release ${{ inputs.version }}" -m "#publish-packages-to-npm&${{ inputs.tag }}"
git tag -a "v${{ inputs.version }}" -m "v${{ inputs.version }}"
GIT_PAGER=cat git show HEAD
- name: Update latest if needed
shell: bash
if: ${{ inputs.tag == 'latest' }}
run: |
git tag -d "latest"
git push origin :latest
git tag -a "latest" -m "latest"
# - name: Pushing release commit
# shell: bash
# run: |
# git push origin $CIRCLE_BRANCH --follow-tags
42 changes: 42 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Prepare Release

on:
workflow_dispatch:
inputs:
version:
description: 'The version of React Native we want to release'
required: true
type: string
tag:
description: 'The tag that should be added to Github'
required: true
type: string
# TODO: remove this
pull_request:

jobs:
prepare_release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Cancel if not on Stable
uses: actions/github-script@v6
with:
script: |
const delay = ms => new Promise(res => setTimeout(res, ms));
console.log(context.ref)
github.rest.actions.cancelWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId
});
while (true) {
core.info('Waiting for workflow to cancel ...');
await delay(5000);
}
- name: Execute Prepare Release
uses: ./.github/actions/prepare_release

0 comments on commit 193de8b

Please sign in to comment.