Skip to content

Commit

Permalink
ci: release action
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinwadon committed Sep 3, 2024
1 parent 304de46 commit 315712c
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release

on:
workflow_dispatch:

jobs:
build-and-release:
name: Build and Release Binaries
runs-on: ubuntu-latest

strategy:
matrix:
os: [linux, darwin, windows, freebsd]
arch: [amd64, 386, arm64, arm]
exclude:
- os: darwin
arch: 386
- os: darwin
arch: arm
- os: windows
arch: arm64
- os: windows
arch: arm
- os: freebsd
arch: 386
- os: freebsd
arch: arm64
- os: freebsd
arch: arm

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Build Binary
run: |
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o snapshot-migration-tool_${{ matrix.os }}_${{ matrix.arch }}${{ matrix.os == 'windows' && '.exe' || '' }}
- name: Create GitHub Release
if: ${{ matrix.os == 'linux' && matrix.arch == 'amd64' }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 'v1.0.0'
release_name: 'v1.0.0'
draft: false
prerelease: false

- name: Upload Binary
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url || github.event.release.upload_url }}
asset_path: ./snapshot-migration-tool_${{ matrix.os }}_${{ matrix.arch }}${{ matrix.os == 'windows' && '.exe' || '' }}
asset_name: snapshot-migration-tool_${{ matrix.os }}_${{ matrix.arch }}${{ matrix.os == 'windows' && '.exe' || '' }}
asset_content_type: application/octet-stream

0 comments on commit 315712c

Please sign in to comment.