44 push :
55 branches :
66 - master
7+ - testing
78 pull_request :
89 branches :
910 - master
1011
1112jobs :
1213 cicd-linux-docker :
13- name : CICD Linux for Docker
14+ name : Cargo and npm build
1415 runs-on : ubuntu-latest
1516 steps :
1617 - name : Checkout sources
@@ -56,28 +57,44 @@ jobs:
5657 command : build
5758 args : --release
5859
59- - name : Set up Node.js
60- uses : actions/setup-node@v1
61- with :
62- node-version : 14
63-
64- - name : npm install
60+ - name : Build frontend
6561 working-directory : ./web
66- run : npm install
62+ run : docker build . --file Dockerfile --tag web
6763
68- - name : Build
64+ - name : Compile js
6965 working-directory : ./web
70- run : npm run build
66+ run : docker run --rm -v $GITHUB_WORKSPACE/dist:/stackgog/dist web sh -c "npm run build"
67+
68+ # - name: npm install
69+ # working-directory: ./web
70+ # run: npm install
71+ #
72+ # - name: Build
73+ # working-directory: ./web
74+ # run: npm run build
7175
7276# - name: Test
7377# working-directory: ./web
7478# run: npm test
7579
80+ # - name: Get npm cache directory
81+ # working-directory: ./web
82+ # id: npm-cache-dir
83+ # run: |
84+ # echo "::set-output name=dir::$(npm config get cache)"
85+ # - uses: actions/cache@v2
86+ # id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
87+ # with:
88+ # path: ${{ steps.npm-cache-dir.outputs.dir }}
89+ # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
90+ # restore-keys: |
91+ # ${{ runner.os }}-node-
92+
7693 - name : Copy app files and zip
7794 run : |
78- mkdir app
95+ mkdir -p app/stackdog/dist
7996 cp target/release/stackdog app/stackdog
80- cp web /dist app/stackdog
97+ cp -a $GITHUB_WORKSPACE /dist/. app/stackdog
8198 cp docker/prod/Dockerfile app/Dockerfile
8299 cd app
83100 touch .env
@@ -111,5 +128,4 @@ jobs:
111128 repository : trydirect/stackdog
112129 add_git_labels : true
113130 tag_with_ref : true
114- # no-cache: true
115- context : ./app
131+ # no-cache: true
0 commit comments