forked from chryswoods/openportal
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (111 loc) · 4.45 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# 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