Update README.md #3
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 Build and Release | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
push: | |
branches: | |
- main | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go 1.22.4 | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22.4 | |
- name: Install dependencies | |
run: go mod tidy | |
- name: Run tests | |
run: go test ./... | |
release: | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go 1.22.4 | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22.4 | |
- name: Install dependencies | |
run: go mod tidy | |
- name: Cross-compile binaries | |
run: | | |
GOOS=linux GOARCH=amd64 go build -o dist/linux_amd64/AIOPrivacyBot | |
GOOS=linux GOARCH=arm64 go build -o dist/linux_arm64/AIOPrivacyBot | |
GOOS=darwin GOARCH=amd64 go build -o dist/darwin_amd64/AIOPrivacyBot | |
GOOS=darwin GOARCH=arm64 go build -o dist/darwin_arm64/AIOPrivacyBot | |
GOOS=windows GOARCH=amd64 go build -o dist/windows_amd64/AIOPrivacyBot.exe | |
GOOS=windows GOARCH=arm64 go build -o dist/windows_arm64/AIOPrivacyBot.exe | |
- name: Create release notes | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: v${{ github.run_number }} | |
release_name: Release ${{ github.run_number }} | |
body: | | |
Release of version ${{ github.run_number }} | |
Commit: ${{ github.sha }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload release assets | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/linux_amd64/AIOPrivacyBot | |
asset_name: myapp-linux-amd64 | |
asset_content_type: application/octet-stream | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload release assets (Linux ARM64) | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/linux_arm64/AIOPrivacyBot | |
asset_name: myapp-linux-arm64 | |
asset_content_type: application/octet-stream | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload release assets (Darwin AMD64) | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/darwin_amd64/AIOPrivacyBot | |
asset_name: myapp-darwin-amd64 | |
asset_content_type: application/octet-stream | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload release assets (Darwin ARM64) | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/darwin_arm64/AIOPrivacyBot | |
asset_name: myapp-darwin-arm64 | |
asset_content_type: application/octet-stream | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload release assets (Windows AMD64) | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/windows_amd64/AIOPrivacyBot.exe | |
asset_name: myapp-windows-amd64 | |
asset_content_type: application/octet-stream | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload release assets (Windows ARM64) | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/windows_arm64/AIOPrivacyBot.exe | |
asset_name: myapp-windows-arm64 | |
asset_content_type: application/octet-stream | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |