Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish release binaries from GitHub actions #52

Merged
merged 11 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
test:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest , windows-latest ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
go: [ '1.13', '1.17', '>=1.18' ]
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} - go${{ matrix.go }}
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish release binaries

on:
release:
types:
- published

jobs:
publish:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} - go${{ matrix.go }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '>=1.18'
check-latest: true
- name: Run go build for amd64
run: |
go build -o gokey-amd64 ./cmd/gokey
env:
CGO_ENABLED: 0
- name: Run go build for arm64
run: |
go build -o gokey-arm64 ./cmd/gokey
env:
CGO_ENABLED: 0
GOARCH: arm64
- name: Upload Linux binary
if: runner.os == 'Linux'
run: |
ls
mv gokey-amd64 gokey-${{ github.ref_name }}-linux-amd64
mv gokey-arm64 gokey-${{ github.ref_name }}-linux-arm64
gh release upload ${{ github.ref_name }} gokey-${{ github.ref_name }}-linux-amd64 gokey-${{ github.ref_name }}-linux-arm64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Windows binary
if: runner.os == 'Windows'
run: |
mv gokey-amd64 gokey-${{ github.ref_name }}-windows-amd64.exe
mv gokey-arm64 gokey-${{ github.ref_name }}-windows-arm64.exe
gh release upload ${{ github.ref_name }} gokey-${{ github.ref_name }}-windows-amd64.exe gokey-${{ github.ref_name }}-windows-arm64.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload MacOS binary
if: runner.os == 'macOS'
run: |
mv gokey-amd64 gokey-${{ github.ref_name }}-darwin-amd64
mv gokey-arm64 gokey-${{ github.ref_name }}-darwin-arm64
gh release upload ${{ github.ref_name }} gokey-${{ github.ref_name }}-darwin-amd64 gokey-${{ github.ref_name }}-darwin-arm64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}