-
Notifications
You must be signed in to change notification settings - Fork 31
90 lines (87 loc) · 3.14 KB
/
push-ci.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
name: CI build and push
concurrency:
group: pr-${{ github.event.number }}
on:
push:
branches:
- main
- v[0-9]+
- v[0-9]+.[0-9]+
- cryostat-v[0-9]+.[0-9]+
jobs:
code-analysis:
uses: ./.github/workflows/ci-code-analysis.yml
with:
checkout-repo: ${{ github.event.pull_request.head.repo.full_name }}
checkout-ref: ${{ github.event.pull_request.head.ref }}
secrets: inherit
if: github.repository_owner == 'cryostatio'
build-and-test-amd64:
uses: ./.github/workflows/ci-build-image.yml
secrets: inherit
with:
build-arch: amd64
if: github.repository_owner == 'cryostatio'
build-and-test-arm64:
uses: ./.github/workflows/ci-build-image.yml
secrets: inherit
with:
build-arch: arm64
skip-itests: true
if: github.repository_owner == 'cryostatio'
push-to-quay:
runs-on: ubuntu-latest
needs: [code-analysis, build-and-test-amd64, build-and-test-arm64]
env:
CRYOSTAT_IMG: quay.io/cryostat/cryostat
if: always() && github.repository_owner == 'cryostatio'
steps:
- uses: actions/download-artifact@v3
with:
name: cryostat-amd64
if: github.repository_owner == 'cryostatio'
- name: Load cryostat-amd64 image
env:
IMAGE_VERSION: ${{ needs.build-and-test-amd64.outputs.image-version }}
run: |
podman load -i cryostat-amd64.tar
podman tag quay.io/cryostat/cryostat:latest $CRYOSTAT_IMG:$IMAGE_VERSION-linux-amd64
if: github.repository_owner == 'cryostatio'
- uses: actions/download-artifact@v3
with:
name: cryostat-arm64
if: github.repository_owner == 'cryostatio'
- name: Load cryostat-arm64 image
env:
IMAGE_VERSION: ${{ needs.build-and-test-arm64.outputs.image-version }}
run: |
podman load -i cryostat-arm64.tar
podman tag quay.io/cryostat/cryostat:latest $CRYOSTAT_IMG:$IMAGE_VERSION-linux-arm64
if: github.repository_owner == 'cryostatio'
- name: Create OCI Manifest
id: create-manifest
env:
IMAGE_VERSION: ${{ needs.build-and-test-amd64.outputs.image-version }}
run: |
podman manifest create $CRYOSTAT_IMG:$IMAGE_VERSION containers-storage:$CRYOSTAT_IMG:$IMAGE_VERSION-linux-amd64 containers-storage:$CRYOSTAT_IMG:$IMAGE_VERSION-linux-arm64
if [ "$GITHUB_REF" == "refs/heads/main" ]; then
podman tag \
${{ env.CRYOSTAT_IMG }}:$IMAGE_VERSION \
${{ env.CRYOSTAT_IMG }}:latest
echo "::set-output name=tags::$IMAGE_VERSION latest"
else
echo "::set-output name=tags::$IMAGE_VERSION"
fi
if: github.repository_owner == 'cryostatio'
- name: Push to quay.io
uses: redhat-actions/push-to-registry@v2
with:
image: cryostat
tags: ${{ steps.create-manifest.outputs.tags }}
registry: quay.io/cryostat
username: cryostat+bot
password: ${{ secrets.REGISTRY_PASSWORD }}
if: github.repository_owner == 'cryostatio'
- name: Print image URL
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
if: github.repository_owner == 'cryostatio'