Skip to content

Update go-build-release.yml #3

Update go-build-release.yml

Update go-build-release.yml #3

name: Build and Release
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22.4
- name: Install dependencies
run: go mod tidy
- name: Build binaries
run: |
mkdir -p dist
GOOS=linux GOARCH=amd64 go build -o dist/AIOPrivacyBot-linux-amd64
GOOS=linux GOARCH=arm64 go build -o dist/AIOPrivacyBot-linux-arm64
GOOS=windows GOARCH=amd64 go build -o dist/AIOPrivacyBot-windows-amd64.exe
GOOS=darwin GOARCH=amd64 go build -o dist/AIOPrivacyBot-darwin-amd64
GOOS=darwin GOARCH=arm64 go build -o dist/AIOPrivacyBot-darwin-arm64
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/AIOPrivacyBot-linux-amd64
asset_name: AIOPrivacyBot-linux-amd64
asset_content_type: application/octet-stream
- name: Upload Release Assets (linux-arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/AIOPrivacyBot-linux-arm64
asset_name: AIOPrivacyBot-linux-arm64
asset_content_type: application/octet-stream
- name: Upload Release Assets (windows-amd64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/AIOPrivacyBot-windows-amd64.exe
asset_name: AIOPrivacyBot-windows-amd64.exe
asset_content_type: application/octet-stream
- name: Upload Release Assets (darwin-amd64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/AIOPrivacyBot-darwin-amd64
asset_name: AIOPrivacyBot-darwin-amd64
asset_content_type: application/octet-stream
- name: Upload Release Assets (darwin-arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/AIOPrivacyBot-darwin-arm64
asset_name: AIOPrivacyBot-darwin-arm64
asset_content_type: application/octet-stream