Skip to content

Commit

Permalink
Add build static binary workflow
Browse files Browse the repository at this point in the history
Add build strategy in workflow
  • Loading branch information
icodex committed Nov 16, 2021
1 parent ab36f7f commit b7d175e
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build-static-binary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Build static binary
on:
push:
tags:
- 'v*'
env:
BUILDER_IMAGE: ghcr.io/icodex/nixos-nix:v2.3.15

jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
- arch: arm64
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build skopeo binary file
run: |
DIGEST=$(skopeo --insecure-policy --override-arch ${{ matrix.arch }} inspect docker://${BUILDER_IMAGE} | jq -r '.Digest')
docker run --rm -t -v $PWD:/build ${BUILDER_IMAGE}@${DIGEST} \
sh -c "cd /build && nix build -f nix && cp ./result/bin/skopeo skopeo-linux-${{ matrix.arch }}"
sha256sum skopeo-linux-${{ matrix.arch }} > skopeo-linux-${{ matrix.arch }}.sha256sum.txt
- name: Release and upload binary file
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
skopeo-linux-${{ matrix.arch }}
skopeo-linux-${{ matrix.arch }}.sha256sum.txt

0 comments on commit b7d175e

Please sign in to comment.