Skip to content

Commit

Permalink
[FSMCPB-152082] Migrate to GHA (#166)
Browse files Browse the repository at this point in the history
* [FSMCPB-152082] Migrate to GHA

* update gha

* update gha

* update gha

* update ts dependency version

* revert ts bump

* test the test step

* revert test changes

* include push workflow

* update changes

* test

* test

* test

* test

* test

* test

* test

* test npm publish

* final changes

* Revert changes on ShellSdk.spec.ts
  • Loading branch information
zaheral authored Oct 30, 2024
1 parent 7c79045 commit f4c2bcc
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/fsh-shell_pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: fsm-shell pull request
run-name: '[ON_PR fsm-shell] ${{ github.sha }}'

on:
pull_request:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm i
- name: Unit tests
run: npm run test:ci:headless

test-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm i
- name: Run build
run: npm run build
65 changes: 65 additions & 0 deletions .github/workflows/fsh-shell_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: fsm-shell push
run-name: '[ON_PUSH fsm-shell] ${{ github.sha }}'

on:
push:
branches: [master]

jobs:
ensure-mandatory-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check
env:
REQUIRED_FILES: CHANGELOG.md package.json package-lock.json
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
FILES_CHANGED=$(git diff --diff-filter='AMTCR' --name-only origin/master HEAD | tr '[:upper:]' '[:lower:]')
echo $FILES_CHANGED
array=( $REQUIRED_FILES )
missing_files=""
for i in "${array[@]}"
do
[[ ${FILES_CHANGED[*]} =~ $i ]] && echo "$i file found in the changeset" || missing_files="$missing_files $i"
done
echo ""
[ -z "$missing_files" ] && echo "All mandatory files have been modified" || echo "Following files $missing_files have not been modified"
[ -z "$missing_files" ] && exit 0 || exit 1
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm i
- name: Unit tests
run: npm run test:ci:headless

publish:
runs-on: ubuntu-latest
needs:
- test
- ensure-mandatory-files
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm i
- name: Run build
run: npm run build
- name: Prepare files
run: |
mkdir npm_public
mv release package.json package-lock.json npm_public
cd npm_public
echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} > .npmrc
- name: Publish
run: |
cd npm_public
npm publish

0 comments on commit f4c2bcc

Please sign in to comment.