Skip to content

Commit

Permalink
added reusable make-dapp.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
anatolse committed Sep 8, 2024
1 parent a82b24b commit 17d22cb
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/make-dapp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
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:
description: 'Version of the application'
required: true
default: '1.0.0'
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 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": "${{ inputs.manifest_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

0 comments on commit 17d22cb

Please sign in to comment.