feat: add ci for Build and Release #1
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
name: Build and Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.20' | |
- name: Build | |
run: | | |
go build -o bin/tt main.go # Adjust this command according to your project's build process | |
mkdir -p dist | |
cp bin/tt dist/ | |
- name: Archive binaries | |
run: | | |
zip -j dist/tt_${{ matrix.os }}.zip dist/tt | |
- name: Upload Release Asset | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tt_${{ matrix.os }}.zip | |
path: dist/tt_${{ matrix.os }}.zip | |
release: | |
name: Create Release | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
body: | | |
Release notes for ${{ github.ref_name }} | |
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: dist/tt_${{ matrix.os }}.zip | |
asset_name: tt_${{ matrix.os }}.zip | |
asset_content_type: application/zip |