Refactored and added credit #50
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-macos | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
arch: [amd64, arm64] | |
exclude: | |
- os: windows-latest | |
arch: arm64 | |
go-version: [1.22.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Display Go version | |
run: go version | |
- name: Install dependencies | |
run: go mod tidy | |
- name: Build | |
run: go build -v -o agdownloader-${{ matrix.os }}-${{ matrix.arch }} | |
- name: Upload binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: agdownloader-${{ matrix.os }}-${{ matrix.arch }} | |
path: agdownloader-${{ matrix.os }}-${{ matrix.arch }} | |
create_release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download binaries | |
uses: actions/download-artifact@v3 | |
with: | |
path: ./binaries | |
- name: List files in binaries directory | |
run: ls -laR ./binaries | |
- name: Zip all binaries | |
run: | | |
cd binaries | |
zip -r agdownloader-binaries.zip agdownloader-* | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | |
with: | |
tag_name: v1.2.${{ github.run_number }} | |
release_name: Release v1.2.${{ github.run_number }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./binaries/agdownloader-binaries.zip | |
asset_name: agdownloader-binaries.zip | |
asset_content_type: application/zip |