I've recently completed initial versions of my Bitshares NFT issuance & viewer applications & chose to utilize GitHub's action workflow system to build and release the distributable files.
I made the decision to use GitHub workflow actions for a few reasons:
- Free automated building of apps vs elecriticty bill vs premium service
- Free wins out 🍻😅
- The bitshares-ui repo uses it and we were considering the switch to it from appveyor for the bitshares beet repo; The sha256 and accompanying markdown yaml steps were taken from the bitshares-ui action workflow yaml file 👍
- It's pretty simple to configure and there's plenty of actions on the github marketplace to further support our app development
When a commit is tagged e.g. v.1.0.1 a new free workflow run will begin the build and release process.
Within the workflow job the YAML is processed to show the individual steps both in a list and visual component.
Once complete the newly published release will include the built packages and accompanying markdown:
The following is the YAML required to build and release the NFT issuance application; It uses the latest recommended actions to do so.
For the time being only windows and linux are supported as the macos build requires a code signing certificate; macos users can however manually build the apps so fear not.
name: Build/release
on:
push:
tags:
- "v*.*.*"
jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: ${{ github.ref_name }}
draft: false
prerelease: false
generate_release_notes: false
build:
name: build_release
needs: create_release
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
include:
- os: windows-latest
release_suffix: windows
release_format: exe
#- os: macos-latest
# release_suffix: macos
# release_format: dmg
- os: ubuntu-latest
release_suffix: ubuntu
release_format: deb
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
- run: yarn install
- run: yarn run electron:package:${{ matrix.os }}
- name: Upload .${{ matrix.release_format }} file
uses: actions/upload-artifact@v3
with:
name: nft_tool.${{ matrix.release_format }}
path: dist/nft_tool.${{ matrix.release_format }}
generate:
name: generate files
needs: build
runs-on: ubuntu-latest
steps:
- name: Download exe
id: download
uses: actions/download-artifact@v3
with:
name: nft_tool.exe
path: ~/
- name: Download deb
uses: actions/download-artifact@v3
with:
name: nft_tool.deb
path: ~/
- name: Calculate hashes
id: calc_hash
run: |
echo "::set-output name=debhash::$(sha256sum /home/runner/nft_tool.deb|cut -c-64)"
echo "::set-output name=exehash::$(sha256sum /home/runner/nft_tool.exe|cut -c-64)"
- name: Perform release
uses: softprops/action-gh-release@v1
with:
files: |
/home/runner/nft_tool.exe
/home/runner/nft_tool.deb
# ${{steps.download.outputs.download-path}}nft_tool.dmg
tag_name: ${{ needs.create_release.outputs.tag-name }}
body: |
Release Notes
_________________________________
Binaries for download
--------
| Platform | SHA256 Checksum |
|---|---|
|[Microsoft Windows](https://github.com/BTS-CM/Bitshares_NFT_Issuance_Tool/releases/download/${{ github.ref_name }}/nft_tool.exe)|`${{steps.calc_hash.outputs.exehash}}`|
|[Linux](https://github.com/BTS-CM/Bitshares_NFT_Issuance_Tool/releases/download/${{ github.ref_name }}/nft_tool.deb)|`${{steps.calc_hash.outputs.debhash}}`|
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
How could the above be further improved?
- We can submit released deliverables to virustotal for scan to improve user confidence running unsigned code.
- Additional binary checksums
- Caching the build environment to reduce build times (10 mins for windows)
- Code signing for macos support
- Include commit changelog in markdown
Have you used GitHub action workflows before? Any suggestions or ideas?