-
Notifications
You must be signed in to change notification settings - Fork 3.4k
58 lines (47 loc) · 1.77 KB
/
rest-sample.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# SPDX-License-Identifier: Apache-2.0
#
name: REST Sample 🐧
run-name: ${{ github.actor }} is testing the REST Sample 🐧
env:
NODE_VER: 18.x
on:
workflow_dispatch:
push:
branches: [ "main", "release-2.5" ]
paths: [ "asset-transfer-basic/rest-api-typescript/**" ]
pull_request:
branches: [ "main", "release-2.5" ]
paths: [ "asset-transfer-basic/rest-api-typescript/**" ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test-sample:
runs-on: fabric-ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VER }}
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install REST Sample Dependencies
working-directory: asset-transfer-basic/rest-api-typescript
run: npm install
- name: Build REST Sample Application
run: npm run build
working-directory: asset-transfer-basic/rest-api-typescript
- name: Test REST Sample Application
run: npm test
working-directory: asset-transfer-basic/rest-api-typescript
- name: Build REST Sample Docker Image
run: docker build -t ghcr.io/hyperledger/fabric-rest-sample .
working-directory: asset-transfer-basic/rest-api-typescript
- name: Publish REST Sample Docker Image
if: github.event_name == 'push' && (github.ref == 'refs/heads/main')
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker push ghcr.io/hyperledger/fabric-rest-sample:latest
working-directory: asset-transfer-basic/rest-api-typescript