Skip to content

26 add build workflow #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build and Package .dapp

on:
push:
branches:
- master
- 26-add-build-workflow
pull_request:
branches:
- master
- 26-add-build-workflow

jobs:
build:
uses: ticotipme/Burn/.github/workflows/make-dapp.yaml@26-add-build-workflow
with:
manifest_name: 'Tico Burn'
manifest_description: 'much burn less TICO'
manifest_version_prefix: "1.0"
manifest_guid: '98c591cfdbed4c75aac2b53288ce770c'
dapp_name: 'tico-burn'
114 changes: 114 additions & 0 deletions .github/workflows/make-dapp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Reusable Build and Package .dapp

on:
workflow_call:
inputs:
node_version:
description: 'Node.js version to use'
default: '16'
type: string
build_command:
description: 'Command to build the project'
default: 'yarn build'
type: string
manifest_name:
description: 'Name of the .dapp application'
required: true
type: string
manifest_description:
description: 'Description of the .dapp application'
required: true
type: string
manifest_icon:
description: 'Path to the icon file'
default: 'localapp/app/logo.svg'
type: string
manifest_url:
description: 'URL for the application'
default: 'localapp/app/index.html'
type: string
manifest_version_prefix:
description: 'Version prefix of the application'
required: true
type: string
manifest_api_version:
description: 'API version of the application'
default: '7.0'
type: string
manifest_min_api_version:
description: 'Minimum API version required'
default: '7.0'
type: string
manifest_guid:
description: 'GUID for the .dapp manifest'
required: true
type: string
dapp_name:
description: 'Name of the dapp'
required: true
type: string

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="${{inputs.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 ${{ inputs.dapp_name }}/app

- name: Copy build files
run: cp -r html/* ${{ inputs.dapp_name }}/app/

- name: Create manifest.json
run: |
echo '{
"name": "${{ inputs.manifest_name }}",
"description": "${{ inputs.manifest_description }}",
"icon": "${{ inputs.manifest_icon }}",
"url": "${{ inputs.manifest_url }}",
"version": "${{ env.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 }}
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
Loading