Update go.yml #4
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: Go | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' | |
- name: Install project dependencies | |
run: go mod download | |
- name: Install Docker | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ca-certificates curl | |
sudo install -m 0755 -d /etc/apt/keyrings | |
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | |
sudo chmod a+r /etc/apt/keyrings/docker.asc | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ | |
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update | |
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
- name: Install fyne-cross | |
run: go install github.com/fyne-io/fyne-cross@latest | |
- name: Build project using Makefile | |
run: make build | |
- name: Archive Linux binary | |
run: tar -czvf linux-amd64-binary.tar.gz -C fyne-cross/bin/linux-amd64 . | |
- name: Archive Windows binary | |
run: zip -r windows-amd64-binary.zip fyne-cross/bin/windows-amd64/* | |
- name: Upload Linux Release Assets | |
uses: actions/upload-release-asset@v1 | |
if: github.event_name == 'release' | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./linux-amd64-binary.tar.gz | |
asset_name: linux-amd64-binary.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload Windows Release Assets | |
uses: actions/upload-release-asset@v1 | |
if: github.event_name == 'release' | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./windows-amd64-binary.zip | |
asset_name: windows-amd64-binary.zip | |
asset_content_type: application/zip |