Skip to content
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

Build cleanup #5

Merged
merged 5 commits into from
Nov 8, 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
2 changes: 1 addition & 1 deletion .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: Chia-Network/actions/clean-workspace@main

- name: Checkout current branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Need PACKAGE_ADMIN_PAT token so when the tag is created, the tag automation runs
token: ${{ secrets.PACKAGE_ADMIN_PAT }}
Expand Down
204 changes: 24 additions & 180 deletions .github/workflows/build-installers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
tags:
- '**'
branches:
- refactor/refactor-base #remove this once rebuild is merged
pull_request:
branches:
- '**'
Expand All @@ -19,148 +17,16 @@ permissions:
id-token: write
contents: write

jobs:
build_mac:
name: Build Mac Installer
runs-on: macos-latest
steps:
- uses: Chia-Network/actions/clean-workspace@main

- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node 20
uses: actions/setup-node@v3
with:
node-version: '20.10'

- name: Install Husky
run: npm install --save-dev husky

- name: install dmg-license
run: npm i dmg-license

- name: npm install
run: |
npm install

- name: Import Apple installer signing certificate
uses: Apple-Actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_DEV_ID_APP }}
p12-password: ${{ secrets.APPLE_DEV_ID_APP_PASS }}

- name: Build electron app
env:
CSC_FOR_PULL_REQUEST: "true"
run: npm run electron:package:mac

- name: Notarize
run: |
DMG_FILE=$(find ${{ github.workspace }}/dist/ -type f -name '*.dmg')
xcrun notarytool submit \
--wait \
--apple-id "${{ secrets.APPLE_NOTARIZE_USERNAME }}" \
--password "${{ secrets.APPLE_NOTARIZE_PASSWORD }}" \
--team-id "${{ secrets.APPLE_TEAM_ID }}" \
"$DMG_FILE"

- name: Upload Mac Installer
uses: actions/upload-artifact@v3
with:
name: cadt-ui-mac-installer
path: ${{ github.workspace }}/dist/*.dmg

build_windows:
name: Build Windows Installer
runs-on: windows-2019
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node 20.10
uses: actions/setup-node@v3
with:
node-version: '20.10'

- name: Install Husky
run: npm install --save-dev husky

- name: Ignore Husky where not compatible
run: npm pkg delete scripts.prepare

- name: npm install
run: |
node --version
npm install

- name: Build electron app
run: npm run electron:package:win

# Windows Code Signing
- name: Get installer name for signing
shell: bash
run: |
FILE=$(find dist -type f -maxdepth 1 -name '*.exe')
echo "Installer file is $FILE"
echo "INSTALLER_FILE=$FILE" >> "$GITHUB_ENV"

- name: Sign windows artifacts
uses: chia-network/actions/digicert/windows-sign@main
with:
sm_api_key: ${{ secrets.SM_API_KEY }}
sm_client_cert_file_b64: ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}
sm_client_cert_password: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
sm_code_signing_cert_sha1_hash: ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }}
file: "${{ github.workspace }}/${{ env.INSTALLER_FILE }}"

- name: Upload Windows Installer
uses: actions/upload-artifact@v3
with:
name: cadt-ui-windows-installer
path: "${{ github.workspace }}/${{ env.INSTALLER_FILE }}"

build_linux:
name: Build Linux Installer
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node 20.10
uses: actions/setup-node@v3
with:
node-version: '20.10'

- name: Install Husky
run: npm install --save-dev husky

- name: npm install
run: |
node --version
npm install

- name: Build electron app
run: npm run electron:package:linux

- name: Rename Linux installer to be standard format for apt
run: |
ORIGINAL=$(ls dist/*.deb)
MODIFIED=${ORIGINAL:0:-10}-1${ORIGINAL#${ORIGINAL:0:-10}}
mv $ORIGINAL $MODIFIED

- name: Upload Linux Installer
uses: actions/upload-artifact@v3
with:
name: cadt-ui-linux-installer
path: ${{ github.workspace }}/dist/*.deb
env:
APP_NAME: core-registry-dashboard

jobs:
build_web:
name: Build CADT UI Web App
name: Build Core Registry Dashboard Web App
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node 20.10
uses: actions/setup-node@v3
Expand All @@ -174,80 +40,58 @@ jobs:
run: |
node --version
npm install
npm run build
npm run web-build

- name: Create .tar.gz of the web build
run: tar -cvzf cadt-ui-web-build.tar.gz build
run: tar -cvzf ${{ env.APP_NAME }}-web-build.tar.gz build

- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: cadt-ui-web-build
path: cadt-ui-web-build.tar.gz
name: ${{ env.APP_NAME }}-web-build
path: ${{ env.APP_NAME }}-web-build.tar.gz

release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- build_mac
- build_windows
- build_linux
- build_web
steps:
- name: Download Windows artifacts
uses: actions/download-artifact@v3
with:
name: cadt-ui-windows-installer
path: cadt-ui-windows-installer

- name: Download MacOS artifacts
uses: actions/download-artifact@v3
with:
name: cadt-ui-mac-installer
path: cadt-ui-mac-installer

- name: Download Linux artifacts
uses: actions/download-artifact@v3
with:
name: cadt-ui-linux-installer
path: cadt-ui-linux-installer

- name: Download Web artifact
uses: actions/download-artifact@v3
with:
name: cadt-ui-web-build
path: cadt-ui-web-build
name: ${{ env.APP_NAME }}-web-build
path: ${{ env.APP_NAME }}-web-build

- name: Get Filenames
run: |
DMG_FILE=$(find ${{ github.workspace }}/cadt-ui-mac-installer/ -type f -name '*.dmg')
DEB_FILE=$(find ${{ github.workspace }}/cadt-ui-linux-installer/ -type f -name '*.deb')
EXE_FILE=$(find ${{ github.workspace }}/cadt-ui-windows-installer/ -type f -name '*.exe')
WEB_FILE=$(find ${{ github.workspace }}/cadt-ui-web-build/ -type f -name '*.tar.gz')

echo "DMG_FILE=$DMG_FILE" >>$GITHUB_ENV
echo "DEB_FILE=$DEB_FILE" >>$GITHUB_ENV
echo "EXE_FILE=$EXE_FILE" >>$GITHUB_ENV
WEB_FILE=$(find ${{ github.workspace }}/${{ env.APP_NAME }}-web-build/ -type f -name '*.tar.gz')

echo "WEB_FILE=$WEB_FILE" >>$GITHUB_ENV

- name: Release
uses: softprops/[email protected]
with:
files: |
${{ env.DMG_FILE }}
${{ env.DEB_FILE }}
${{ env.EXE_FILE }}
${{ env.WEB_FILE }}

- name: Get tag name
id: tag-name
run: |
echo "TAGNAME=$(echo $GITHUB_REF | cut -d / -f 3)" >>$GITHUB_OUTPUT

- name: Get repo name
id: repo-name
run: |
echo "REPO_NAME=$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f 2)" >>$GITHUB_OUTPUT

- name: Gets JWT Token from GitHub
uses: Chia-Network/actions/github/jwt@main

- name: Trigger apt repo update
run: |
curl -s -XPOST -H "Authorization: Bearer ${{ env.JWT_TOKEN }}" --data '{"cadt_repo":"cadt-ui","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/cadt/${{ github.sha }}/start
curl -s -XPOST -H "Authorization: Bearer ${{ env.JWT_TOKEN }}" --data '{"cadt_repo":"cadt-ui","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/cadt/${{ github.sha }}/success/deploy
uses: Chia-Network/actions/github/glue@main
with:
json_data: '{"climate_tokenization_repo":"${{ steps.repo-name.outputs.REPO_NAME }}","application_name":"[\"${{ env.APP_NAME }}\"]","release_version":"${{ steps.tag-name.outputs.TAGNAME }}","add_debian_version":"true","arm64":"false"}'
glue_url: ${{ secrets.GLUE_API_URL }}
glue_project: "climate-tokenization"
glue_path: "trigger"
6 changes: 3 additions & 3 deletions .github/workflows/ensure-version-increment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
- uses: Chia-Network/actions/clean-workspace@main

- name: Checkout current branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: branch-repo

- name: Checkout main
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: main
path: main-repo
Expand All @@ -35,7 +35,7 @@ jobs:
branch_version=$(cat $GITHUB_WORKSPACE/branch-repo/package.json | jq -r '.version')
echo "Main version: $main_version"
echo "Branch version: $branch_version"

if [[ "$branch_version" == "$main_version" ]]; then
echo "Version in package.json on this branch is not changing. Version must incremenet for a merge to main"
exit 1
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ dist

# TernJS port file
.tern-port

# Web build
build/
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 9 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "cadt-ui",
"name": "core-registry-dashboard",
"private": true,
"version": "0.0.10",
"type": "module",
"main": "build/main.js",
"engineStrict": true,
"author": "Chia Network Inc. <[email protected]>",
"description": "Climate Action Data Trust User Interface",
"description": "Core Registry Dashboard",
"engines": {
"node": ">=20.0"
},
Expand Down Expand Up @@ -89,8 +89,8 @@
"*.+(js|ts|tsx)": "npm run lint:prettier-eslint"
},
"build": {
"appId": "org.worldbank.climate-action-data-trust",
"productName": "cadt-ui",
"appId": "org.worldbank.core-registry-dashboard",
"productName": "core-registry-dashboard",
"files": [
"build/renderer/**/*",
"build/**/*",
Expand All @@ -106,24 +106,18 @@
"universal"
]
},
"publish": null,
"icon": "src/assets/img/CADT_Icon.png"
"publish": null
},
"win": {
"target": "nsis",
"publish": null,
"icon": "src/assets/img/CADT_Icon.png"
"publish": null
},
"linux": {
"target": "deb",
"description": "Climate Action Data Trust User Interface",
"description": "Core Registry Dashboard",
"maintainer": "Chia Network Inc. <[email protected]>",
"vendor": "https://climateactiondata.org/",
"publish": null,
"icon": "src/assets/img/CADT_Icon.png",
"desktop": {
"Icon": "/usr/share/icons/hicolor/0x0/apps/cadt-ui.png"
}
"vendor": "https://www.chia.net/",
"publish": null
}
}
}
Loading