Skip to content

Commit

Permalink
test: working on linux only release
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Feb 10, 2024
1 parent 14a65c8 commit 7b99a4e
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 12 deletions.
80 changes: 68 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: release

env:
GO111MODULE: on
GO_VERSION: 1.21

on:
push:
Expand All @@ -13,17 +14,22 @@ permissions:
contents: write

jobs:
goreleaser:
build-linux-binary:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: gcc install
run: sudo apt-get update; sudo apt install gcc-aarch64-linux-gnu
- name: Get tag
uses: little-core-labs/get-git-tag@v3.0.2
id: tag
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: ${{ env.GO_VERSION }}
- name: Cache code
uses: actions/cache@v4
with:
Expand All @@ -35,18 +41,68 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install ARM64 cross-compilation tools
run: |
sudo apt-get update
sudo apt-get install -y libsqlite3-dev
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5.0.0
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --clean --debug
args: release --skip-publish --config .goreleaser-for-linux.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#- name: Syndicate to GoDocs
# run: make godocs
GORELEASER_PREVIOUS_TAG: ${{steps.latest_version.outputs.release}}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: alert-system-linux
path: |
dist/alert-system_*.zip
dist/checksums.txt
create-release:
#needs: [build-linux-binary, build-darwin-binary, build-windows-binary]
needs: [build-linux-binary]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Make directories
run: |
mkdir -p ./dist/linux
mkdir -p ./dist/darwin
mkdir -p ./dist/windows
- name: Download linux binaries
uses: actions/download-artifact@v4
with:
name: alert-system-linux
path: ./tmp-build/linux
#- name: Download darwin binaries
# uses: actions/download-artifact@v3
# with:
# name: kubectl-eds-darwin
# path: ./tmp-build/darwin
#- name: Download windows binaries
# uses: actions/download-artifact@v3
# with:
# name: kubectl-eds-windows
# path: ./tmp-build/windows
- name: Get tag
uses: little-core-labs/get-git-tag@v3.0.2
id: tag
- name: Prepare ./dist folder
run: |
mkdir -p ./dist
mv ./tmp-build/linux/*.zip ./dist
#- name: Generate Plugin manifest
# run: ./hack/release/generate-plugin-manifest.sh ${{steps.tag.outputs.tag}}
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: dist/CHANGELOG.md
prerelease: ${{ contains(github.ref, '-rc.') }}
files: |
dist/*.zip
dist/*.tar.gz
env:
COMMIT_TAG: ${{steps.tag.outputs.tag}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71 changes: 71 additions & 0 deletions .goreleaser-for-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Make sure to check the documentation at http://goreleaser.com
# ---------------------------
# General
# ---------------------------
before:
hooks:
- make all
snapshot:
name_template: "{{ .Tag }}"
changelog:
sort: asc
filters:
exclude:
- '^.github:'
- '^.vscode:'
- '^docs:'
- '^test:'

# ---------------------------
# Builder
#
# CGO is enabled and inspiration came from:
# https://github.com/goreleaser/goreleaser-cross-example
# https://github.com/goreleaser/goreleaser-cross-example-sysroot
# https://github.com/DataDog/extendeddaemonset/blob/main/.goreleaser-for-linux.yaml
# ---------------------------
builds:
- id: linux-build
main: ./cmd/
binary: alert_system
goos:
- linux
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=1
#- PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64
#- PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig
#- CC=o64-clang # (GitHub action)
#- CXX=o64-clang++ # (GitHub action)
#- CC=clang # Changed from o64-clang (works for mac)
#- CXX=clang++ # Changed from o64-clang++ (works for mac)
#mod_timestamp: "{{ .CommitTimestamp }}"
#flags:
# - -mod=readonly
ldflags:
- -s -w -X main.version={{.Version}}
#- -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }}
overrides:
- goos: linux
goarch: arm64
env:
- CC=aarch64-linux-gnu-gcc

# ---------------------------
# Archives + Checksums
# ---------------------------
archives:
- id: alert_system
builds:
- linux-build
name_template: "kubectl-eds_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
wrap_in_directory: false
format: zip
files:
- LICENSE
checksum:
name_template: "{{ .ProjectName }}_checksums.txt"
algorithm: sha256

File renamed without changes.

0 comments on commit 7b99a4e

Please sign in to comment.