-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and rename go.yml to build.yml
- Loading branch information
1 parent
3f65d2a
commit 67c9d20
Showing
2 changed files
with
62 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Build and upload binaries | ||
on: | ||
release: | ||
types: [published] | ||
push: | ||
pull_request: | ||
permissions: | ||
contents: read | ||
jobs: | ||
build: | ||
name: Build binaries | ||
runs-on: ubuntu-latest | ||
environment: "Build, release binaries" | ||
strategy: | ||
matrix: | ||
include: | ||
- {GOOS: linux, GOARCH: amd64} | ||
- {GOOS: linux, GOARCH: arm, GOARM: 6} | ||
- {GOOS: linux, GOARCH: arm64} | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.x | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build binary | ||
run: | | ||
VERSION="$(git describe --tags)" | ||
DIR="$(mktemp -d)" | ||
mkdir "$DIR/mankidown" | ||
go build -o "$DIR/mankidown" -ldflags "-X main.Version=$VERSION" -trimpath ./cmd/... | ||
tar -cvzf "mankidown-$VERSION-$GOOS-$GOARCH.tar.gz" -C "$DIR" mankidown | ||
env: | ||
CGO_ENABLED: 0 | ||
GOOS: ${{ matrix.GOOS }} | ||
GOARCH: ${{ matrix.GOARCH }} | ||
GOARM: ${{ matrix.GOARM }} | ||
- name: Upload workflow artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: mandidown-binaries | ||
path: mankidown | ||
upload: | ||
name: Upload release binaries | ||
if: github.event_name == 'release' | ||
needs: build | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download workflow artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: mankidown-binaries | ||
- name: Upload release artifacts | ||
run: gh release upload "$GITHUB_REF_NAME" mankidown-* | ||
env: | ||
GH_REPO: ${{ github.repository }} | ||
GH_TOKEN: ${{ github.token }} |
This file was deleted.
Oops, something went wrong.