Add auto update feature #48
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: Wails build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
NODE_OPTIONS: "--max-old-space-size=4096" | |
jobs: | |
test-go: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Golang | |
uses: actions/setup-go@v4 | |
with: | |
check-latest: true | |
go-version: '1.21' | |
- run: mkdir -p frontend/dist && touch frontend/dist/test.txt | |
- run: go test ./... | |
build: | |
name: Build | |
needs: test-go | |
outputs: | |
version: ${{ steps.create_release.outputs.tag }} | |
strategy: | |
matrix: | |
os: [windows] | |
arch: [amd64] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create release tag | |
id: create_release | |
run: | | |
TAG="v$(date +'%d%m%Y')-$(echo ${{ github.sha }} | cut -c1-8)" | |
echo "Creating release tag $TAG" | |
echo "::set-output name=tag::$TAG" | |
- run: mv ./artifacts/**/marshaller-* ./ | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Golang | |
uses: actions/setup-go@v5 | |
with: | |
check-latest: true | |
go-version: '1.21' | |
- name: Setup Nodejs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '21.5' | |
- name: Install Wails | |
run: go install github.com/wailsapp/wails/v2/cmd/[email protected] | |
- 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 macOS Wails deps | |
if: runner.os == 'macOS' | |
run: brew install mitchellh/gon/gon | |
- name: Build App | |
run: wails build --platform ${{ matrix.os}}/${{ matrix.arch }} -webview2 embed -o marshaller-${{ matrix.os }}-${{ matrix.arch }} -ldflags "-X github.com/kacpermalachowski/marshal-controller/internal/build.Version=${{ steps.create_release.outputs.tag }} -X github.com/kacpermalachowski/marshal-controller/internal/build.Time=$(date)" | |
- name: Add macOS permissions | |
if: runner.os == 'macOS' | |
run: chmod +x build/bin/*/Contents/MacOS/* | |
shell: bash | |
- name: Add Linux permissions | |
if: runner.os == 'Linux' | |
run: chmod +x build/bin/* | |
shell: bash | |
- run: for x in marshaller-windows-*; do mv $x $x.exe; done | |
working-directory: ./build/bin/ | |
if: matrix.os == 'windows' | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: marshaller-${{ matrix.os }}-${{ matrix.arch }} | |
path: ./build/bin/marshaller-* | |
retention-days: 1 | |
create_release: | |
if: github.event_name == 'push' | |
name: Create release | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
contents: write | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Create release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: ./marshaller-* | |
generateReleaseNotes: true | |
tag: ${{ needs.build.outputs.version }} | |