Skip to content

Commit

Permalink
Merge pull request #18 from kaltura/FEC-12201
Browse files Browse the repository at this point in the history
FEC-12201 Fixed GH actions with more features
  • Loading branch information
GouravSna authored Nov 2, 2022
2 parents c0cca08 + a848b81 commit 5b76390
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 46 deletions.
14 changes: 14 additions & 0 deletions .github/release_notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Release Notes for GitHub
cat << EOF > post.json
{
"name": "v$BRANCH_NAME",
"body": "# Kaltura Player React Native \n https://www.npmjs.com/package/kaltura-player-rn/v/$BRANCH_NAME",
"tag_name": "v$BRANCH_NAME"
}
EOF

# echo "BRANCH_NAME is = v$BRANCH_NAME"

POST_URL=https://api.github.com/repos/$GITHUB_REPOSITORY/releases/generate-notes

curl $POST_URL -X POST -H "Accept: application/vnd.github+json" -H "Content-Type: application/json" -H "Authorization: Bearer $GITHUB_TOKEN" [email protected] #--include
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ concurrency:
jobs:

react-native_and_android:
environment: Build
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -43,6 +44,7 @@ jobs:
run: cd android && chmod +x ./gradlew && ./gradlew build --no-daemon

iOS:
environment: Build
runs-on: macos-latest

steps:
Expand Down
60 changes: 52 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,69 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: publish CI

on:
release:
types: [created]
workflow_dispatch:
inputs:
target_branch:
description: "Give the correct branch name from where a new branch will be created."
required: true
type: string
release_type:
type: choice
description: 'Release Type'
options:
- stg
- patch
release_branch_name:
type: string
required: true
description: "New Branch name (Without 'v' Ex: 1.0.0)"

env:
TARGET_BRANCH: ${{ inputs.target_branch}}
RELEASE_TYPE: ${{ inputs.release_type}}
BRANCH_NAME: ${{ inputs.release_branch_name}}

jobs:
npm_publish:
create_tag:
environment: Release
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v3
- name: Setup node

- name: Setup node 📥
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- name: Install package Manager

- name: Print Branch Name
run: |
echo "Branch Name: ${BRANCH_NAME}"
- name: Setup Github Config
run: |
git config user.name "Github Actions Bot KLTR"
git config user.email "<>"
- name: Create Branch
run: |
git branch ${RELEASE_TYPE}/v${BRANCH_NAME} ${TARGET_BRANCH}
git push origin ${RELEASE_TYPE}/v${BRANCH_NAME}
- name: Create Tag 🏷️
run: |
git tag v${BRANCH_NAME} ${GITHUB_SHA}
git push origin v${BRANCH_NAME}
- name: Create Release Notes
run: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} BRANCH_NAME=${BRANCH_NAME} bash .github/release_notes.sh
- name: Install package Manager 📥
run: yarn install

- name: Publish to NPM 📦
run: yarn publish
env:
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/tag.yml

This file was deleted.

0 comments on commit 5b76390

Please sign in to comment.