v0.5.10 #166
Workflow file for this run
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
on: | |
release: | |
types: | |
- created | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
branches-ignore: | |
- "dependabot/**" | |
name: Release | |
jobs: | |
linux: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
include: | |
- arch: amd64 | |
cc: gcc | |
- arch: arm64 | |
cc: aarch64-linux-gnu-gcc | |
- arch: arm | |
arm: 6 | |
cc: arm-linux-gnueabi-gcc | |
- arch: arm | |
arm: 7 | |
cc: arm-linux-gnueabihf-gcc | |
env: | |
GOOS: linux | |
GOARCH: ${{ matrix.arch }} | |
GOARM: ${{ matrix.arm }} | |
CC: ${{ matrix.cc }} | |
VERSION: "${{ github.event_name == 'release' && github.event.release.name || github.sha }}" | |
MAIN_VERSION: "${{ github.event_name == 'release' && github.event.release.name || '' }}" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'go.mod' | |
- id: release | |
uses: bruceadams/[email protected] | |
if: github.event_name == 'release' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Install cross-compilers | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi | |
- name: Build binary | |
run: | | |
rm -rf dist | |
mkdir -p dist | |
CGO_ENABLED=1 go build -ldflags "-s -w -extldflags "-static" -X 'main.Version=${{ env.MAIN_VERSION }}' -X 'main.Commit=${{ github.sha }}'" -tags osusergo,netgo -o dist/litefs ./cmd/litefs | |
cd dist | |
tar -czvf litefs-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}.tar.gz litefs | |
- name: Upload binary artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: litefs-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }} | |
path: dist/litefs | |
if-no-files-found: error | |
- name: Upload release tarball | |
uses: actions/[email protected] | |
if: github.event_name == 'release' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
asset_path: ./dist/litefs-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}.tar.gz | |
asset_name: litefs-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}.tar.gz | |
asset_content_type: application/gzip |