feat: release automation #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish @deriv/deriv-charts and update package in deriv-app | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
build_and_publish_deriv_charts: | ||
runs-on: Ubuntu-latest | ||
permissions: | ||
checks: write | ||
contents: write | ||
steps: | ||
- name: Checkout SmartCharts | ||
uses: 'binary-com/SmartCharts/.github/actions/checkout@master' | ||
with: | ||
repository: 'binary-com/SmartCharts' | ||
path: SmartCharts | ||
ref: master | ||
- name: Custom flutter-chart | ||
id: flutter_chart | ||
uses: 'binary-com/SmartCharts/.github/actions/checkout@master' | ||
with: | ||
repository: 'regentmarkets/flutter-chart' | ||
path: flutter-chart | ||
ref: fe-changes | ||
token: ${{ secrets.REPO_READ_TOKEN }} | ||
- uses: subosito/flutter-action@88cab4064b0a5145b0b53b42565b68248a3d7bcb | ||
with: | ||
flutter-version: '3.10.6' | ||
channel: 'stable' | ||
cache: true | ||
- name: Add SSH key | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/github_action_key | ||
chmod 600 ~/.ssh/github_action_key | ||
- name: Build flutter | ||
env: | ||
GIT_SSH_COMMAND: 'ssh -i ~/.ssh/github_action_key' | ||
run: | | ||
cd SmartCharts/chart_app | ||
flutter pub get | ||
flutter build web --web-renderer html --release | ||
- name: Setup node | ||
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 | ||
with: | ||
node-version: 20.x | ||
registry-url: "https://registry.npmjs.org" | ||
- name: Setup SmartCharts | ||
run: cd SmartCharts && npm install | ||
- name: Publish SmartCharts | ||
run: cd SmartCharts && npm run build | ||
- name: Prepublish SmartCharts | ||
run: npm run prepublish | ||
- name: Release SmartCharts | ||
if: success() | ||
env: | ||
CI: true | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npx semantic-release | ||
update_chart_version_in_deriv_app: | ||
runs-on: Ubuntu-latest | ||
permissions: | ||
checks: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout deriv-app | ||
uses: 'binary-com/SmartCharts/.github/actions/checkout@master' | ||
with: | ||
repository: 'binary-com/deriv-app' | ||
path: deriv-app | ||
ref: master | ||
- name: Get the new chart version | ||
id: check_new_version | ||
run: | | ||
new_version=$(npm show @deriv/deriv-charts version) | ||
echo "new_version=$new_version" >> $GITHUB_OUTPUT | ||
- name: Update package.json | ||
id: update_package_json | ||
run: | | ||
cd deriv-app | ||
new_version=${{ steps.check_new_version.outputs.new_version }} | ||
npm install @deriv/deriv-charts@$new_version | ||
- name: Update trader package.json | ||
run: | | ||
cd deriv-app/packages/trader | ||
new_version=${{ steps.check_new_version.outputs.new_version }} | ||
npm install @deriv/deriv-charts@$new_version | ||
- name: Update bot-web-ui package.json | ||
run: | | ||
cd deriv-app/packages/bot-web-ui | ||
new_version=${{ steps.check_new_version.outputs.new_version }} | ||
npm install @deriv/deriv-charts@$new_version | ||
- name: Create Pull Request to deriv-app | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
commit-message: "chore: update @deriv/deriv-charts to ${{ steps.check_new_version.outputs.new_version }}" | ||
title: "chore: update @deriv/deriv-charts to ${{ steps.check_new_version.outputs.new_version }}" | ||
body: "This PR updates the @deriv/deriv-charts to ${{ steps.check_new_version.outputs.new_version }}" | ||
branch: "chore/update-deriv-charts-to-${{ steps.check_new_version.outputs.new_version }}" | ||
base: "master" | ||