Merge pull request #437 from fitzthum/fix-se-link #2
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
name: Build and Push kbs-client | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build_and_push: | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- x86_64 | |
- s390x | |
env: | |
RUSTC_VERSION: 1.76.0 | |
runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-22.04' || 's390x' }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Take a pre-action for self-hosted runner | |
run: | | |
# NOTE: Use file checking instead triggering a step based on a runner type | |
# to avoid updating the step for each new self-hosted runner. | |
if [ -f "${HOME}/script/pre_action.sh" ]; then | |
"${HOME}/script/pre_action.sh" cc-trustee | |
fi | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain (${{ env.RUSTC_VERSION }}) | |
run: | | |
rustup update --no-self-update ${{ env.RUSTC_VERSION }} | |
rustup component add --toolchain ${{ env.RUSTC_VERSION }} rustc | |
rustup default ${{ env.RUSTC_VERSION }} | |
- name: Log in to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build a statically linked kbs-client for ${{ matrix.arch }} linux | |
working-directory: kbs | |
run: | | |
make cli-static-linux | |
- name: Push to ghcr.io | |
working-directory: target/${{ matrix.arch }}-unknown-linux-gnu/release | |
run: | | |
commit_sha=${{ github.sha }} | |
oras push \ | |
ghcr.io/confidential-containers/staged-images/kbs-client:sample_only-${{ matrix.arch }}-linux-gnu-${commit_sha},latest-${{ matrix.arch }} \ | |
kbs-client | |
if [ "$(uname -m)" = "x86_64" ]; then | |
oras push ghcr.io/confidential-containers/staged-images/kbs-client:latest kbs-client | |
fi | |
- name: Take a post-action for self-hosted runner | |
if: always() | |
run: | | |
# Please check out the note in the pre-action step for the reason of using file checking | |
if [ -f "${HOME}/script/post_action.sh" ]; then | |
"${HOME}/script/post_action.sh" cc-trustee | |
fi |