add build workflow #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Package .dapp | |
on: | |
push: | |
branches: | |
- mainnet | |
- workflow-test | |
pull_request: | |
branches: | |
- mainnet | |
- workflow-test | |
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="1.0.${{ env.COMMIT_COUNT }}" | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Set up Node.js environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' # Use the version of Node.js required by your project | |
- name: Install dependencies | |
run: yarn install | |
- name: Build the project | |
run: yarn build | |
- 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": "BeamX DAO Voting", | |
"description": "Voting on Beam community proposals", | |
"icon": "localapp/app/logo.svg", | |
"url": "localapp/app/index.html", | |
"version": "${VERSION}", | |
"api_version": "7.0", | |
"min_api_version": "7.0", | |
"guid": "c26538f5ce9e410b89c1fd0dff783f97" | |
}' > dao-voting/manifest.json | |
- name: Package into .dapp file | |
run: | | |
cd dao-voting | |
zip -r ../dao-voting.dapp ./* | |
cd .. | |
- name: Upload .dapp file | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dao-voting.dapp | |
path: dao-voting.dapp |