Skip to content

Workflow file for this run

name: Build and Release
on:
push:
tags:
- "v*.*.*" # trigger when tag is vX.X.X
workflow_dispatch:
inputs:
tag:
description: "Tag to build and release"
required: true
default: "v0.0.0"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
build-platform: linux/amd64
build-name: crypto-monitor
- os: macos-latest
build-platform: darwin/universal
build-name: crypto-monitor
- os: windows-latest
build-platform: windows/amd64
installer-name: crypto-monitor-installer.exe
executable-name: crypto-monitor-windows-amd64.exe
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup GoLang
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install Linux Wails deps
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install libgtk-3-0 libwebkit2gtk-4.0-dev gcc-aarch64-linux-gnu
- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Install Go Dependencies
run: go mod tidy
- name: Install frontend dependencies
run: |
cd frontend
npm install
- name: Build Wails App
if: runner.os != 'Windows'
run: wails build --platform ${{matrix.build-platform}} -webview2 download -o ${{matrix.build-name}}
- name: Build Windows Installer
if: runner.os == 'Windows'
run: wails build --platform ${{matrix.build-platform}} -webview2 download -nsis -o ${{matrix.installer-name}}
- name: Build Windows Executable
if: runner.os == 'Windows'
run: wails build --platform ${{matrix.build-platform}} -webview2 download -o ${{matrix.executable-name}}
- uses: actions/upload-artifact@v3
if: runner.os != 'Windows'
with:
name: crypto-monitor-${{matrix.os}}
path: ${{matrix.build-name}}
- uses: actions/upload-artifact@v3
if: runner.os == 'Windows'
with:
name: crypto-monitor-windows-installer
path: ${{matrix.installer-name}}
- uses: actions/upload-artifact@v3
if: runner.os == 'Windows'
with:
name: crypto-monitor-windows-executable
path: ${{matrix.executable-name}}
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: ./artifacts
- name: Get Version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
- name: Upload Windows Installer Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/crypto-monitor-windows-latest/crypto-monitor-installer.exe
asset_name: crypto-monitor-${{ steps.get_version.outputs.VERSION }}-windows-amd64-installer.exe
asset_content_type: application/vnd.microsoft.portable-executable
- name: Upload Windows Executable Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/crypto-monitor-windows-latest/crypto-monitor-windows-amd64.exe
asset_name: crypto-monitor-${{ steps.get_version.outputs.VERSION }}-windows-amd64.exe
asset_content_type: application/vnd.microsoft.portable-executable
- name: Upload macOS Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/crypto-monitor-macos-latest/crypto-monitor
asset_name: crypto-monitor-${{ steps.get_version.outputs.VERSION }}-macos-universal
asset_content_type: application/x-apple-app
- name: Upload Linux Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/crypto-monitor-ubuntu-latest/crypto-monitor
asset_name: crypto-monitor-${{ steps.get_version.outputs.VERSION }}-linux-amd64
asset_content_type: application/x-elf