Skip to content

chore: create install.sh #62

chore: create install.sh

chore: create install.sh #62

Workflow file for this run

name: Glox Release
on:
push:
branches:
- main
workflow_dispatch:
defaults:
run:
working-directory: ./glox
jobs:
analyze_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.20.0'
check-latest: true
- run: go version
- name: Format
run: go fmt ./...
- name: Static Analysis
run: go vet ./...
- name: Test
run: go test ./... -v
build_macos_artifacts:
runs-on: macos-13
needs: [analyze_and_test]
strategy:
matrix:
os: [macos-13]
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.20.0'
check-latest: true
- run: go version
- name: Build Binary for ${{ matrix.os }} / ${{ matrix.arch }}
run: |
case ${{ matrix.arch }} in
amd64) GOOS=darwin GOARCH=${{ matrix.arch }} ;;
arm64) GOOS=darwin GOARCH=${{ matrix.arch }} ;;
esac
go build -v -o glox-macos-${{ matrix.arch }}
- name: Upload artifacts for ${{ matrix.os }} / ${{ matrix.arch }}
uses: actions/upload-artifact@v2
with:
name: glox-macos-${{ matrix.arch }}
path: ./glox/glox-macos-${{ matrix.arch }}
build_linux_artifacts:
runs-on: ubuntu-latest
needs: [analyze_and_test]
strategy:
matrix:
os: [ubuntu-latest]
arch: [amd64]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.20.0'
check-latest: true
- run: go version
- name: Build Binary for ${{ matrix.os }} / ${{ matrix.arch }}
run: |
go build -v -o glox-linux-${{ matrix.arch }}
- name: Upload artifact for ${{ matrix.os }} / ${{ matrix.arch }}
uses: actions/upload-artifact@v2
with:
name: glox-linux-${{ matrix.arch }}
path: ./glox/glox-linux-${{ matrix.arch }}
build_windows_artifact:
runs-on: windows-latest
needs: [analyze_and_test]
strategy:
matrix:
os: [windows-latest]
arch: [amd64]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.20.0'
check-latest: true
- run: go version
- name: Build Binary for ${{ matrix.os }} / ${{ matrix.arch }}
run: |
go build -v -o glox-windows-${{ matrix.arch }}.exe
- name: Upload artifact for ${{ matrix.os }} / ${{ matrix.arch }}
uses: actions/upload-artifact@v2
with:
name: glox-windows-${{ matrix.arch }}.exe
path: .\glox\glox-windows-${{ matrix.arch }}.exe
publish_release:
runs-on: ubuntu-latest
needs:
[build_macos_artifacts, build_linux_artifacts, build_windows_artifact]
steps:
- uses: actions/checkout@v3
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v0.0.${{ github.run_number }}
release_name: v0.0.${{ github.run_number }}
draft: false
prerelease: false
- name: Create artifacts directory
run: mkdir -p ../build
- name: Download macos/arm64 artifact
id: download_macos_arm64
uses: actions/download-artifact@v2
with:
name: glox-macos-arm64
path: ../build/
- name: Upload macos/arm64 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: ${{ steps.download_macos_arm64.outputs.download-path }}/glox-macos-arm64
asset_name: glox-macos-arm64
asset_content_type: application/octet-stream
- name: Download macos/amd64 artifact
id: download_macos_amd64
uses: actions/download-artifact@v2
with:
name: glox-macos-amd64
path: ../build/
- name: Upload macos/amd64 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: ${{ steps.download_macos_amd64.outputs.download-path }}/glox-macos-amd64
asset_name: glox-macos-amd64
asset_content_type: application/octet-stream
- name: Download linux artifacts
id: download_linux_artifacts
uses: actions/download-artifact@v2
with:
name: glox-linux-amd64
path: ../build/
- name: Upload linux/amd64 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: ${{ steps.download_linux_artifacts.outputs.download-path }}/glox-linux-amd64
asset_name: glox-linux-amd64
asset_content_type: application/octet-stream
- name: Download windows artifact
id: download_windows_artifact
uses: actions/download-artifact@v2
with:
name: glox-windows-amd64.exe
path: ../build/
- name: Upload windows 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: ${{ steps.download_windows_artifact.outputs.download-path }}/glox-windows-amd64.exe
asset_name: glox-windows-amd64.exe
asset_content_type: application/octet-stream