- update #6
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: Build and Release | |
on: | |
push: | |
branches: | |
- main # Adjust the branch name if needed | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- name: Ubuntu | |
value: ubuntu-latest | |
extension: tar.gz | |
- name: macOS | |
value: macos-latest | |
extension: app | |
- name: Windows | |
value: windows-latest | |
extension: zip | |
go-version: ["1.20"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
id: go | |
- name: Install Fyne | |
run: go install fyne.io/fyne/v2/cmd/fyne@latest | |
- name: Install depends | |
run: go mod tidy | |
- name: Build | |
run: fyne package -os ${{ matrix.os.name }} -icon icon.png | |
- name: Delete Existing Release | |
run: | | |
TAG_NAME="v1.0.0" # Specify your desired tag version | |
RELEASE_ID=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$TAG_NAME" | jq -r '.id') | |
if [ "$RELEASE_ID" != "null" ]; then | |
curl -X DELETE -s -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID" | |
fi | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v1.0.0 # Specify your desired tag version | |
release_name: Release v1.0.0 # Specify your desired release name | |
body: | | |
Describe your release here | |
draft: false | |
prerelease: false | |
- name: Upload 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: ./CloneMe.${{ matrix.os.extension }} | |
asset_name: CloneMe-${{ matrix.os.name }}-v1.0.0.${{ matrix.os.extension }} | |
asset_content_type: application/zip |