Skip to content

Release Sherlo packages #58

Release Sherlo packages

Release Sherlo packages #58

Workflow file for this run

name: Release Sherlo packages
on:
workflow_dispatch:
inputs:
NEW_VERSION_NUMBER:
description: 'New version number (e.g., 1.0.1)'
required: false
jobs:
release-to-prod:
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK_URL}}
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
NEW_VERSION_NUMBER: ${{ github.event.inputs.NEW_VERSION_NUMBER }}
concurrency: release-to-prod
steps:
- name: Create GH App Token
id: github_app_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.SHERLO_BOT_APP_ID }}
private_key: ${{ secrets.SHERLO_BOT_PRIVATE_KEY }}
- uses: actions/checkout@v2
with:
token: ${{ steps.github_app_token.outputs.token }}
ref: ${{ github.ref }}
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.18.0'
- name: Install dependencies
run: yarn
- name: Bump Version
run: npx lerna version $NEW_VERSION_NUMBER --yes --no-git-tag-version --no-push
- name: Save version number to native dependencies
run: |
echo "{\"version\": \"$NEW_VERSION_NUMBER\"}" > packages/react-native-storybook/android/src/main/assets/sherlo.json
echo "{\"version\": \"$NEW_VERSION_NUMBER\"}" > packages/react-native-storybook/ios/Resources/assets/sherlo.json
- name: Bump minimum required native dependencies version
run: |
echo "{\"REQUIRED_MIN_SDK_VERSION\": \"$NEW_VERSION_NUMBER\"}" > packages/cli/sdk-compatibility.json
- name: Build packages
run: yarn switch-env:prod
env:
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
- name: Commit and push updated files
uses: EndBug/add-and-commit@v7
with:
author_name: Sherlo Bot
author_email: [email protected]
message: 'Version updates and builds for ${NEW_VERSION_NUMBER}'
push: true
branch: ${{ github.ref_name }}
- name: Configure npm
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- name: Publish to npm
run: npx lerna publish from-package --yes
- name: Tag Commit
run: |
git tag ${{ github.event.inputs.NEW_VERSION_NUMBER }}
git push origin ${{ github.event.inputs.NEW_VERSION_NUMBER }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.NEW_VERSION_NUMBER }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: notify failure on Slack
if: failure()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,commit,author,action,eventName,ref,workflow,job,took