Skip to content

Updated release yml #16

Updated release yml

Updated release yml #16

Workflow file for this run

name: Release Baobud
on:
push:
tags:
- "v*"
branches:
- main
pull_request:
jobs:
build-and-test:
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
arch: amd64
bao_url: https://github.com/openbao/openbao/releases/download/v2.0.1/bao_2.0.1_linux_amd64.deb
# - os: ubuntu-latest
# platform: linux
# arch: arm64
# bao_url: https://github.com/openbao/openbao/releases/download/v2.0.1/bao_2.0.1_linux_arm64.deb
# - os: macos-latest
# platform: darwin
# arch: arm64
# bao_url: https://github.com/openbao/openbao/releases/download/v2.0.1/bao_2.0.1_Darwin_arm64.tar.gz
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Install OpenBao
run: |
if [[ "${{ matrix.bao_url }}" == *.deb ]]; then
curl -Lo openbao.deb ${{ matrix.bao_url }}
sudo dpkg -i openbao.deb
rm openbao.deb
else
curl -Lo openbao.tar.gz ${{ matrix.bao_url }}
tar xzf openbao.tar.gz
sudo mv bao /usr/local/bin/
rm openbao.tar.gz
fi
- name: Run tests
run: make test
- name: Build
env:
GOARCH: ${{ matrix.arch }}
GOOS: ${{ matrix.platform }}
run: |
mkdir -p bin
go build -ldflags="-s -w" -o bin/baobud-${{ matrix.platform }}-${{ matrix.arch }} cmd/main.go
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: baobud-${{ matrix.platform }}-${{ matrix.arch }}
path: bin/baobud-${{ matrix.platform }}-${{ matrix.arch }}
release:
needs: build-and-test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Prepare artifacts for release
run: |
cd bin
chmod +x */baobud-*
for dir in */; do
mv "$dir"/* ../bin/
- name: Generate checksums
run: |
cd bin
sha256sum baobud-* > checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
bin/baobud-linux-amd64
bin/checksums.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}