-
Notifications
You must be signed in to change notification settings - Fork 3
112 lines (98 loc) · 3.14 KB
/
make-dapp.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Reusable Build and Package .dapp
on:
workflow_call:
inputs:
node_version:
description: 'Node.js version to use'
required: true
default: '16'
build_command:
description: 'Command to build the project'
required: true
default: 'yarn build'
manifest_name:
description: 'Name of the .dapp application'
required: true
manifest_description:
description: 'Description of the .dapp application'
required: true
manifest_icon:
description: 'Path to the icon file'
required: true
default: 'localapp/app/logo.svg'
manifest_url:
description: 'URL for the application'
required: true
default: 'localapp/app/index.html'
manifest_version_prefix:
description: 'Version prefix of the application'
required: true
manifest_api_version:
description: 'API version of the application'
required: true
default: '7.0'
manifest_min_api_version:
description: 'Minimum API version required'
required: true
default: '7.0'
manifest_guid:
description: 'GUID for the .dapp manifest'
required: true
dapp_name:
description: 'Name of the dapp'
required: true
secrets:
GITHUB_TOKEN:
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Git
run: git fetch --prune --unshallow
- name: Get commit count
id: commit_count
run: |
COMMIT_COUNT=$(git rev-list --count HEAD)
echo "COMMIT_COUNT=${COMMIT_COUNT}" >> $GITHUB_ENV
- name: Generate version
id: version
run: |
VERSION="${{input.manifest_version_prefix}}.${{ env.COMMIT_COUNT }}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Set up Node.js environment
uses: actions/setup-node@v2
with:
node-version: ${{ inputs.node_version }}
- name: Install dependencies
run: yarn install
- name: Build the project
run: ${{ inputs.build_command }}
- name: Create folder structure
run: mkdir -p dao-voting/app
- name: Copy build files
run: cp -r html/* dao-voting/app/
- name: Create manifest.json
run: |
echo '{
"name": "${{ inputs.manifest_name }}",
"description": "${{ inputs.manifest_description }}",
"icon": "${{ inputs.manifest_icon }}",
"url": "${{ inputs.manifest_url }}",
"version": "${VERSION}",
"api_version": "${{ inputs.manifest_api_version }}",
"min_api_version": "${{ inputs.manifest_min_api_version }}",
"guid": "${{ inputs.manifest_guid }}"
}' > ${{ inputs.dapp-name }}/manifest.json
- name: Package into .dapp file
run: |
cd ${{ inputs.dapp_name }}.dapp
zip -r ../${{ inputs.dapp_name }}.dapp ./*
cd ..
- name: Upload .dapp file
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.dapp_name }}.dapp
path: ${{ inputs.dapp_name }}.dapp