Skip to content

Commit

Permalink
GithubActions: Build release binaries with containers
Browse files Browse the repository at this point in the history
  • Loading branch information
aveenismail committed Aug 10, 2023
1 parent 24a1480 commit 277c92b
Showing 1 changed file with 71 additions and 1 deletion.
72 changes: 71 additions & 1 deletion .github/workflows/release_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,74 @@ jobs:
uses: actions/upload-artifact@v1
with:
name: yubihsm-connector-ubuntu2004-amd64
path: artifact
path: artifact

debian_based:
strategy:
fail-fast: false
matrix:
environment: [
"ubuntu:23.04",
"ubuntu:22.04",
"debian:12",
"debian:11",
]

name: build on ${{ matrix.environment }}
runs-on: ubuntu-latest
container: ${{ matrix.environment }}

steps:

- name: Checkout repository
uses: actions/checkout@v2

- name: extract platform name
env:
DOCKER_IMAGE: ${{ matrix.environment }}
run: |
# Remove everything from DOCKER_IMAGE that is not a letter or a number
PLATFORM=$(echo -n "$DOCKER_IMAGE" | sed -E 's/[^a-zA-Z0-9]//g')
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
- name: Build binary
run: |
set -e -o pipefail
set -x
mkdir -p artifact/yubihsm-connector
sudo apt-get update && sudo apt-get dist-upgrade -y
sudo apt-get install -y libusb-1.0.0-dev
export PATH=$PATH:/usr/local/go/bin:~/go/bin
if [[ ! -x $(command -v go ) ]]; then
curl -L --max-redirs 2 -o - https://golang.org/dl/go1.17.linux-amd64.tar.gz |\
sudo tar -C /usr/local -xzvf -
fi
if [[ ! -x $(command -v go-bin-deb) ]]; then
curl -L -o go-bin-deb.dpkg https://github.com/mh-cbon/go-bin-deb/releases/download/0.0.19/go-bin-deb-amd64.deb
sudo dpkg -i go-bin-deb.dpkg
sudo apt-get install --fix-missing
fi
make
strip --strip-all bin/yubihsm-connector
version=`bin/yubihsm-connector version`
go-bin-deb generate -f deb/deb.json -a amd64 --version=${version}-1
cp *.deb artifact/yubihsm-connector
./bin/yubihsm-connector version
./bin/yubihsm-connector --help
LICESE_DIR="artifact/yubihsm-connector/share/yubihsm-connector"
mkdir -p $LICESE_DIR
cp -r resources/release/licenses $LICESE_DIR/
for lf in $LICESE_DIR/licenses/*; do
chmod 644 $lf
done
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: "yubihsm-connector-${{ env.PLATFORM }}-amd64"
path: ${{ env.PLATFORM }}

0 comments on commit 277c92b

Please sign in to comment.