-
Notifications
You must be signed in to change notification settings - Fork 69
81 lines (76 loc) · 3.05 KB
/
head-builds.yaml
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
name : Branch head Prerelease Images
on:
push:
branches:
- main
- release/v[0-9]+.0
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: docker.io
REPO : rancher
permissions:
contents: write
jobs:
prebuild-env:
name: Prebuild needed Env vars
runs-on : runs-on,image=ubuntu22-full-x64,runner=4cpu-linux-x64,run-id=${{ github.run_id }}
steps:
- name: Check out the repository to the runner
uses: actions/checkout@v4
- name: Set Branch Tag and Other Variables
id: set-vars
run: bash ./.github/scripts/branch-tags.sh >> $GITHUB_OUTPUT
outputs:
branch_tag: ${{ steps.set-vars.outputs.branch_tag }}
branch_static_tag: ${{ steps.set-vars.outputs.branch_static_tag }}
prev_tag: ${{ steps.set-vars.outputs.prev_tag }}
push:
needs : [
prebuild-env,
]
permissions:
contents : read
id-token: write
name : Build and push BRO images
runs-on : runs-on,image=ubuntu22-full-x64,runner=4cpu-linux-x64,run-id=${{ github.run_id }}
steps:
- name : "Read vault secrets"
uses : rancher-eio/read-vault-secrets@main
if: ${{ github.repository_owner == 'rancher' }}
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD
- name : Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.DOCKER_USERNAME || vars.REPO }}
password: ${{ env.DOCKER_PASSWORD || secrets.DOCKER_PW }}
- name: Build and push BRO image
env:
FULL_IMAGE_URL: "${{ env.REGISTRY }}/${{ vars.REPO || env.REPO || github.repository_owner }}/backup-restore-operator"
uses: docker/build-push-action@v6
with:
context: .
file: ./package/Dockerfile
build-args: |
TAG=${{ needs.prebuild-env.outputs.branch_static_tag }}
push: true
tags: ${{ env.FULL_IMAGE_URL }}:${{ needs.prebuild-env.outputs.branch_static_tag }}
platforms: linux/amd64,linux/arm64
- name: Update rolling tag to new static tag
env:
FULL_IMAGE_URL: ${{ env.REGISTRY }}/${{ vars.REPO || env.REPO || github.repository_owner }}/backup-restore-operator
run: |
VERSION="1.2.0"
curl -LO "https://github.com/oras-project/oras/releases/download/v${VERSION}/oras_${VERSION}_linux_amd64.tar.gz"
mkdir -p oras-install/
tar -zxf oras_${VERSION}_*.tar.gz -C oras-install/
oras-install/oras copy ${{ env.FULL_IMAGE_URL }}:${{ needs.prebuild-env.outputs.branch_static_tag }} ${{ env.FULL_IMAGE_URL }}:${{ needs.prebuild-env.outputs.branch_tag }}