Skip to content

Commit 44c81b2

Browse files
committed
add build script
1 parent 687e620 commit 44c81b2

File tree

3 files changed

+39
-34
lines changed

3 files changed

+39
-34
lines changed

.github/workflows/build.yml .github/workflows/build_and_deploy.yml

+24-8
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,37 @@ on:
1010

1111
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1212
jobs:
13-
# This workflow contains a single job called "build"
14-
build:
15-
# The type of runner that the job will run on
13+
verion_check:
1614
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code from the pull request
17+
uses: actions/checkout@v2
18+
19+
- name: version check
20+
run: |
21+
ls
22+
ls ./bin/utils/
23+
chmod +x ./bin/utils/check_version.sh
24+
cd javascript
25+
../bin/utils/check_version.sh
1726
18-
# Steps represent a sequence of tasks that will be executed as part of the job
27+
build:
28+
needs: verion_check
29+
runs-on: ubuntu-latest
1930
steps:
20-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2131
- uses: actions/checkout@v2
2232

23-
# Runs a set of commands using the runners shell
24-
- name: Install, Build and Test
33+
- name: Install, Build
2534
run: |
2635
sudo npm install -g babel-cli
2736
cd javascript
2837
npm install
2938
npm run build
30-
39+
40+
publish:
41+
needs: build
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Publish
45+
run: |
46+
echo "publish..."

.github/workflows/deploy.yml

-26
This file was deleted.

bin/utils/check_version.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
PACKAGE_NAME=$(grep '"name"' package.json | cut -d '"' -f4 | tr -d '[[:space:]]')
4+
NPM_PACKAGE_VERSIONS=$(npm view $PACKAGE_NAME versions)
5+
PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f4 | tr -d '[[:space:]]')
6+
7+
echo "PACKAGE_NAME: " $PACKAGE_NAME
8+
echo "NPM_PACKAGE_VERSIONS: " $NPM_PACKAGE_VERSION
9+
echo "PACKAGE_VERSION: " $PACKAGE_VERSION
10+
11+
if [[ ${NPM_PACKAGE_VERSIONS[*]} =~ $PACKAGE_VERSION ]]
12+
then
13+
echo "The version number is already being used"
14+
exit 1
15+
fi

0 commit comments

Comments
 (0)