Added permission for release #18
Workflow file for this run
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
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
package: | |
strategy: | |
matrix: | |
go-version: [1.21] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set Version | |
run: echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Get Wails dependencies | |
run: sudo apt update && sudo apt install -y libgtk-3-dev libwebkit2gtk-4.0-dev | |
if: matrix.os == 'ubuntu-latest' | |
- name: Get Wails | |
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest | |
- name: Build package macOS | |
run: | | |
export PATH=${PATH}:`go env GOPATH`/bin | |
echo "building on ${{ matrix.os }}" | |
mkdir -p ~/.wails | |
cp wails.json ~/.wails/ | |
export LOG_LEVEL=debug | |
export GODEBUG=1 | |
wails build | |
echo "converting .app into a .dmg" | |
npm install -g appdmg | |
appdmg dmg-spec.json blocks.dmg | |
zip blocks.zip blocks.dmg | |
if: matrix.os == 'macos-latest' | |
- name: Build package linux | |
run: | | |
export PATH=$PATH:$(go env GOPATH)/bin | |
echo "building on ${{ matrix.os }}" | |
echo ${{ env.GITHUB_REF }} | |
echo ${{ env.GITHUB_HEAD_REF }} | |
mkdir -p ~/.wails | |
cp wails.json ~/.wails/ | |
export LOG_LEVEL=debug | |
export GODEBUG=1 | |
wails build | |
ls -la /home/runner/work/blocks/blocks/build/bin/blocks | |
tar -czvf blocks.tar.gz /home/runner/work/blocks/blocks/build/bin/blocks | |
# wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | |
# chmod +x linuxdeploy*.AppImage | |
# ls ./ | |
# ./linuxdeploy*.AppImage --appdir AppDir --executable ./build/blocks --desktop-file=blocks.AppImage.desktop --icon-file=appicon--512.png --output appimage | |
if: matrix.os == 'ubuntu-latest' | |
- name: Build package windows | |
run: | | |
$GP = (go env GOPATH) | |
$env:path = "$env:path;$GP\bin" | |
echo "building on ${{ matrix.os }}" | |
New-Item -ItemType directory -Path "$HOME\.wails" -Force | |
Copy-Item -Path "$PWD\wails.json" -Destination "$HOME\.wails\wails.json" | |
choco install mingw | |
wails build | |
Compress-Archive -Path D:\a\blocks\blocks\build\bin\blocks* -DestinationPath D:\a\blocks\blocks\blocks.zip | |
if: matrix.os == 'windows-latest' | |
- name: upload artifact macOS | |
uses: actions/upload-artifact@v1 | |
with: | |
name: blocks-macOS | |
path: blocks.zip | |
if: matrix.os == 'macos-latest' | |
- name: upload artifact linux | |
uses: actions/upload-artifact@v2-preview | |
with: | |
name: blocks-linux | |
path: blocks.tar.gz | |
if: matrix.os == 'ubuntu-latest' | |
# - name: upload artifact linux appimage | |
# uses: actions/upload-artifact@v2-preview | |
# with: | |
# name: blocks-linux-appimage | |
# path: blocks-${{ env.VERSION }}-x86_64.AppImage | |
# if: matrix.os == 'ubuntu-latest' | |
- name: upload artifact windows | |
uses: actions/upload-artifact@v1 | |
with: | |
name: blocks-windows | |
path: blocks.zip | |
if: matrix.os == 'windows-latest' | |
release: | |
runs-on: ubuntu-latest | |
needs: package | |
permissions: # Add this line and the following one to specify custom permissions | |
contents: write # This grants the job permission to create releases | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
draft: true | |
prerelease: true | |
- name: Download macOS package | |
uses: actions/download-artifact@v1 | |
with: | |
name: blocks-macOS | |
- name: Upload macOS package to release | |
id: 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: ./blocks-macOS/blocks.zip | |
asset_name: blocks_${{ github.ref }}_macOS.zip | |
asset_content_type: application/octet-stream | |
- name: Download linux package | |
uses: actions/download-artifact@v1 | |
with: | |
name: blocks-linux | |
- name: Upload Linux package to release | |
id: 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: ./blocks-linux/blocks.tar.gz | |
asset_name: blocks_${{ github.ref }}_linux_x86_64.tar.gz | |
asset_content_type: application/octet-stream | |
- name: Download windows package | |
uses: actions/download-artifact@v1 | |
with: | |
name: blocks-windows | |
- name: Upload Windows package to release | |
id: upload-windows-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: ./blocks-windows/blocks.zip | |
asset_name: blocks_${{ github.ref }}_windows_x86_64.zip | |
asset_content_type: application/octet-stream |