Skip to content

Commit

Permalink
fix: merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Aug 24, 2023
2 parents 8e491f3 + 05e734b commit 330b4a5
Show file tree
Hide file tree
Showing 17 changed files with 3,946 additions and 1,097 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
name: Check version increment
runs-on: ubuntu-latest
steps:
- uses: Chia-Network/actions/clean-workspace@main
- name: Clean workspace
uses: Chia-Network/actions/clean-workspace@main

- name: Checkout current branch
uses: actions/checkout@v3
Expand All @@ -24,6 +25,12 @@ jobs:
token: ${{ secrets.PACKAGE_ADMIN_PAT }}
fetch-depth: 0

- name: Configure commit signing for ChiaAutomation
uses: Chia-Network/actions/commit-sign/gpg@main
with:
gpg_private_key: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_KEY }}
passphrase: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_PASSPHRASE }}

- name: Check for current version tag. Create if it doesn't exist
run: |
version=$(cat $GITHUB_WORKSPACE/package.json | jq -r '.version')
Expand All @@ -35,11 +42,10 @@ jobs:
echo "Tag does not exist. Creating and pushing tag"
rm -f CHANGELOG.md
npx conventional-changelog-cli -p angular -i CHANGELOG.md -s -r 0
changes=$(npx conventional-changelog-cli -r 1 | tail -n +2)
git add CHANGELOG.md
git config --global user.name 'ChiaAutomation'
git config --global user.email '[email protected]'
git commit -m "Updating changelog for $version"
git tag $version
git commit -m "chore: Updating changelog for $version"
git tag $version -m "Release $version $changes"
git push origin $version
git push origin main
fi
191 changes: 130 additions & 61 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Build Binaries

on:
push:
branches:
- main
tags:
- '**'
pull_request:
Expand All @@ -22,28 +20,32 @@ jobs:
matrix:
include:
- runs-on: ubuntu-latest
artifact-name: linux-x64
artifact-name: climate-tokenization-engine-linux-x64
build-command: npm run create-linux-x64-dist
- runs-on: [Linux, ARM64]
artifact-name: climate-tokenization-engine-linux-arm64
build-command: npm run create-linux-arm64-dist
- runs-on: macos-latest
artifact-name: macos-x64
artifact-name: climate-tokenization-engine-macos-x64
build-command: npm run create-mac-x64-dist
- runs-on: windows-2019
artifact-name: windows-x64
artifact-name: climate-tokenization-engine-windows-x64
build-command: npm run create-win-x64-dist

steps:
- uses: Chia-Network/actions/clean-workspace@main
- name: Clean workspace
uses: Chia-Network/actions/clean-workspace@main

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

- name: Setup Node 16.x
uses: actions/setup-node@v2.4.1
- name: Setup Node 18.16
uses: actions/setup-node@v3
with:
node-version: '16.0.0'
node-version: '18.16'

- name: Ignore Husky
run: npm set-script prepare ""
run: npm pkg delete scripts.prepare
if: matrix.runs-on != 'windows-2019'

- name: npm install
Expand All @@ -67,35 +69,18 @@ jobs:
run: ${{ matrix.build-command }}

- name: Make executable
run: chmod +x dist/climate-portal

### If using sqlite, uncomment the following 2 sections ###
### and add a line to sign the sqlite binaries in the ###
### Mac section. ###

# - name: Copy sqlite3 (non windows)
# run: cp ./node_modules/sqlite3/build/Release/node_sqlite3.node ./dist/
# if: matrix.runs-on != 'windows-2019'

# - name: Copy sqlite3 (windows)
# run: cp .\node_modules\sqlite3\build\Release\node_sqlite3.node .\dist\
# if: matrix.runs-on == 'windows-2019'
run: chmod +x dist/climate-tokenization*

# Windows Code Signing
- name: Decode code signing cert into an encrypted file
if: matrix.runs-on == 'windows-2019'
uses: kitek/[email protected]
with:
encoded-value: ${{ secrets.WIN_CODE_SIGN_CERT }}
destination-file: .\win_code_sign_cert.pfx

- name: Sign windows artifacts
if: matrix.runs-on == 'windows-2019'
uses: chia-network/actions/sign/windows@main
uses: chia-network/actions/digicert/windows-sign@main
with:
certificate_path: .\win_code_sign_cert.pfx
certificate_password: ${{ secrets.WIN_CODE_SIGN_PASSWORD }}
file: ${{ github.workspace }}/dist/climate-portal.exe
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 }}/dist/climate-tokenization-engine.exe

# Mac .pkg build + sign
- name: Import Apple installer signing certificate
Expand Down Expand Up @@ -124,77 +109,161 @@ jobs:
cp -r ${{ github.workspace }}/dist ${{ github.workspace }}/build-scripts/macos/application
echo "Signing the binaries"
codesign -f -s "Developer ID Application: Chia Network Inc." --timestamp --options=runtime --entitlements ${{ github.workspace }}/build-scripts/macos/entitlements.mac.plist ${{ github.workspace }}/build-scripts/macos/application/climate-portal
codesign -f -s "Developer ID Application: Chia Network Inc." --timestamp --options=runtime --entitlements ${{ github.workspace }}/build-scripts/macos/entitlements.mac.plist ${{ github.workspace }}/build-scripts/macos/application/climate-tokenization-engine
# Makes the .pkg in ./build-scripts/macos/target/pkg
echo "Building the .pkg"
bash ${{ github.workspace }}/build-scripts/macos/build-macos.sh ClimatePortal
bash ${{ github.workspace }}/build-scripts/macos/build-macos.sh ClimateTokenizationEngine
mkdir -p ${{ github.workspace }}/build-scripts/macos/target/pkg-signed
echo "Signing the .pkg"
productsign --sign "Developer ID Installer: Chia Network Inc." ${{ github.workspace }}/build-scripts/macos/target/pkg/ClimatePortal-macos-installer-x64.pkg ${{ github.workspace }}/build-scripts/macos/target/pkg-signed/ClimatePortal-macos-installer-x64.pkg
productsign --sign "Developer ID Installer: Chia Network Inc." ${{ github.workspace }}/build-scripts/macos/target/pkg/ClimateTokenizationEngine-macos-installer-x64.pkg ${{ github.workspace }}/build-scripts/macos/target/pkg-signed/ClimateTokenizationEngine-macos-installer-x64.pkg
echo "Notarizing the .pkg"
npm install -g notarize-cli
notarize-cli \
--file=${{ github.workspace }}/build-scripts/macos/target/pkg-signed/ClimatePortal-macos-installer-x64.pkg \
--bundle-id net.chia.climate-portal \
--file=${{ github.workspace }}/build-scripts/macos/target/pkg-signed/ClimateTokenizationEngine-macos-installer-x64.pkg \
--bundle-id net.chia.climate-tokenization-engine \
--username "${{ secrets.APPLE_NOTARIZE_USERNAME }}" \
--password "${{ secrets.APPLE_NOTARIZE_PASSWORD }}"
- name: Upload Mac Installer
if: matrix.runs-on == 'macos-latest'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: mac-installer
name: climate-tokenization-engine-mac-installer
path: ${{ github.workspace }}/build-scripts/macos/target/pkg-signed

- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
path: ${{ github.workspace }}/dist

debs:
name: Build ${{ matrix.name }} deb
runs-on: ubuntu-latest
needs:
- build
strategy:
matrix:
include:
- name: climate-tokenization-engine-linux-x64
platform: amd64
- name: climate-tokenization-engine-linux-arm64
platform: arm64
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Download Linux artifacts
uses: actions/download-artifact@v3
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}

- name: Get tag name
id: tag-name
run: |
echo "TAGNAME=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
- name: Build .deb
env:
CLIMATE_TOKENIZATION_ENGINE_VERSION: ${{ steps.tag-name.outputs.TAGNAME }}
PLATFORM: ${{ matrix.platform }}
run: |
pip install j2cli
CLI_DEB_BASE="climate-tokenization-engine_${{ steps.tag-name.outputs.TAGNAME }}-1_${PLATFORM}"
mkdir -p "deb/$CLI_DEB_BASE/opt/climate-tokenization-engine"
mkdir -p "deb/$CLI_DEB_BASE/usr/bin"
mkdir -p "deb/$CLI_DEB_BASE/etc/systemd/system"
mkdir -p "deb/$CLI_DEB_BASE/DEBIAN"
j2 -o "deb/$CLI_DEB_BASE/DEBIAN/control" build-scripts/deb/control.j2
cp -r ${{ matrix.name }}/* "deb/$CLI_DEB_BASE/opt/climate-tokenization-engine/"
cp build-scripts/deb/[email protected] deb/$CLI_DEB_BASE/etc/systemd/system/[email protected]
chmod +x deb/$CLI_DEB_BASE/opt/climate-tokenization-engine/climate-tokenization-engine
ln -s ../../opt/climate-tokenization-engine/climate-tokenization-engine "deb/$CLI_DEB_BASE/usr/bin/climate-tokenization-engine"
dpkg-deb --build --root-owner-group "deb/$CLI_DEB_BASE"
- name: Upload deb
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}-deb
path: ${{ github.workspace }}/deb/*.deb

release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- debs
- build
steps:
- name: Download Windows artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: windows-x64
path: windows-x64
name: climate-tokenization-engine-windows-x64
path: climate-tokenization-engine-windows-x64

- name: Download MacOS artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: mac-installer
path: mac-installer
name: climate-tokenization-engine-mac-installer
path: climate-tokenization-engine-mac-installer

- name: Download Linux artifacts
uses: actions/download-artifact@v2
- name: Download Linux x64 artifacts
uses: actions/download-artifact@v3
with:
name: linux-x64
path: linux-x64
name: climate-tokenization-engine-linux-x64
path: climate-tokenization-engine-linux-x64

- name: Download Linux ARM 64 artifacts
uses: actions/download-artifact@v3
with:
name: climate-tokenization-engine-linux-arm64
path: climate-tokenization-engine-linux-arm64

- name: Download Linux x64 deb
uses: actions/download-artifact@v3
with:
name: climate-tokenization-engine-linux-x64-deb
path: climate-tokenization-engine-linux-x64-deb

- name: Download Linux arm64 deb
uses: actions/download-artifact@v3
with:
name: climate-tokenization-engine-linux-arm64-deb
path: climate-tokenization-engine-linux-arm64-deb

- name: Get tag name
id: tag-name
run: |
echo ::set-output name=TAGNAME::$(echo $GITHUB_REF | cut -d / -f 3)
echo "TAGNAME=$(echo $GITHUB_REF | cut -d / -f 3)" >>$GITHUB_OUTPUT
- name: Create zips
run: |
zip -r windows-x64-${{ steps.tag-name.outputs.TAGNAME }}.zip windows-x64
zip -r macos-x64-${{ steps.tag-name.outputs.TAGNAME }}.zip mac-installer
zip -r linux-x64-${{ steps.tag-name.outputs.TAGNAME }}.zip linux-x64
zip -r climate-tokenization-engine-windows-x64-${{ steps.tag-name.outputs.TAGNAME }}.zip climate-tokenization-engine-windows-x64
zip -r climate-tokenization-engine-macos-x64-${{ steps.tag-name.outputs.TAGNAME }}.zip climate-tokenization-engine-mac-installer
zip -r climate-tokenization-engine-linux-x64-${{ steps.tag-name.outputs.TAGNAME }}.zip climate-tokenization-engine-linux-x64
zip -r climate-tokenization-engine-linux-arm64-${{ steps.tag-name.outputs.TAGNAME }}.zip climate-tokenization-engine-linux-arm64
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v0.1.15
with:
files: |
windows-x64-${{ steps.tag-name.outputs.TAGNAME }}.zip
macos-x64-${{ steps.tag-name.outputs.TAGNAME }}.zip
linux-x64-${{ steps.tag-name.outputs.TAGNAME }}.zip
climate-tokenization-engine-windows-x64-${{ steps.tag-name.outputs.TAGNAME }}.zip
climate-tokenization-engine-macos-x64-${{ steps.tag-name.outputs.TAGNAME }}.zip
climate-tokenization-engine-linux-x64-${{ steps.tag-name.outputs.TAGNAME }}.zip
climate-tokenization-engine-linux-arm64-${{ steps.tag-name.outputs.TAGNAME }}.zip
climate-tokenization-engine-linux-x64-deb/*.deb
climate-tokenization-engine-linux-arm64-deb/*.deb
- name: Get repo name
id: repo-name
run: |
echo "REPO_NAME=$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f 2)" >>$GITHUB_OUTPUT
- name: Trigger apt repo update
run: |
curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"climate_tokenization_repo":"${{ steps.repo-name.outputs.REPO_NAME }}","application_name":"climate-tokenization-engine","release_version":"${{ steps.tag-name.outputs.TAGNAME }}","add_debian_version":"true","arm64":"available"}' ${{ secrets.GLUE_API_URL }}/api/v1/climate-tokenization/${{ github.sha }}/start
curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"climate_tokenization_repo":"${{ steps.repo-name.outputs.REPO_NAME }}","application_name":"climate-tokenization-engine","release_version":"${{ steps.tag-name.outputs.TAGNAME }}","add_debian_version":"true","arm64":"available"}' ${{ secrets.GLUE_API_URL }}/api/v1/climate-tokenization/${{ github.sha }}/success/deploy
4 changes: 2 additions & 2 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@v2
uses: actions/checkout@v3
with:
path: branch-repo

- name: Checkout main
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: main
path: main-repo
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules
/dist
/dist
.vscode
Loading

0 comments on commit 330b4a5

Please sign in to comment.