Build artefacts #1
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
# SPDX-FileCopyrightText: © 2024 Christopher Woods <[email protected]> | |
# SPDX-FileCopyrightText: © 2024 Matt Williams <[email protected]> | |
# SPDX-License-Identifier: MIT | |
name: Build artefacts | |
on: | |
workflow_dispatch: | |
workflow_call: | |
inputs: | |
ref: | |
type: string | |
required: true | |
permissions: {} | |
jobs: | |
build-release: | |
name: "Build release (${{ matrix.target }})" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.ref || '' }} | |
fetch-depth: 0 # This is needed so that git-describe works properly to set the version | |
- name: install MUSL | |
run: sudo apt install musl-tools | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-unknown-linux-musl | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build | |
run: cargo build --release | |
- name: Build op-portal OCI image | |
run: oci/portal/build.sh --release | |
- name: Build op-bridge OCI image | |
run: oci/bridge/build.sh --release | |
- name: Get version | |
id: get_version | |
run: | | |
echo version="$(target/release/op-portal --version | tail -n1 | cut -d' ' -f 2)" >> "${GITHUB_OUTPUT}" | |
- name: Get version for Helm | |
id: get_helm_version | |
run: | | |
if [[ "${{ github.ref_name }}" == "master" ]]; then | |
echo version="${{ steps.get_version.outputs.version }}" >> "${GITHUB_OUTPUT}" | |
else | |
echo version="${{ steps.get_version.outputs.version }}.${{ github.ref_name }}" >> "${GITHUB_OUTPUT}" | |
fi | |
- name: package op-portal helm chart | |
run: | | |
helm package helm/portal --version "${{ steps.get_helm_version.outputs.version }}" --app-version "${{ steps.get_version.outputs.version }}" | |
- name: package op-bridge helm chart | |
run: | | |
helm package helm/bridge --version "${{ steps.get_helm_version.outputs.version }}" --app-version "${{ steps.get_version.outputs.version }}" | |
- name: Log in to GHCR | |
uses: redhat-actions/podman-login@v1 | |
with: | |
registry: ghcr.io/${{ github.repository_owner }} | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Log in to Helm GHCR | |
run: echo $GITHUB_TOKEN | helm registry login "ghcr.io/${{ github.repository_owner }}" --username "${{ github.actor }}" --password-stdin | |
env: | |
GITHUB_TOKEN: "${{ github.token }}" | |
- name: Publish op-portal OCI image | |
id: push-portal-to-ghcr | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: op-portal | |
tags: ${{ steps.get_version.outputs.version }} | |
registry: ghcr.io/${{ github.repository_owner }} | |
- name: Publish op-bridge OCI image | |
id: push-bridge-to-ghcr | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: op-bridge | |
tags: ${{ steps.get_version.outputs.version }} | |
registry: ghcr.io/${{ github.repository_owner }} | |
- name: Attest op-portal image | |
uses: actions/attest-build-provenance@v1 | |
id: attest-portal | |
with: | |
subject-name: ghcr.io/${{ github.repository }} | |
subject-digest: ${{ steps.push-portal-to-ghcr.outputs.digest }} | |
push-to-registry: true | |
- name: Attest op-bridge image | |
uses: actions/attest-build-provenance@v1 | |
id: attest-bridge | |
with: | |
subject-name: ghcr.io/${{ github.repository }} | |
subject-digest: ${{ steps.push-bridge-to-ghcr.outputs.digest }} | |
push-to-registry: true | |
- name: Push op-portal Helm chart | |
run: helm push "./op-portal-${{ steps.get_helm_version.outputs.version }}.tgz" "oci://ghcr.io/${{ github.repository_owner }}/charts" | |
- name: Push op-bridge Helm chart | |
run: helm push "./op-bridge-${{ steps.get_helm_version.outputs.version }}.tgz" "oci://ghcr.io/${{ github.repository_owner }}/charts" | |
- name: Store build artefacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: openportal-agents | |
path: | | |
target/release/op-portal | |
target/release/op-bridge | |
target/release/op-provider | |
target/release/op-cluster | |
target/release/op-slurm | |
target/release/op-filesystem | |
target/release/op-freeipa | |