This repository was archived by the owner on Feb 11, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (116 loc) · 4.27 KB
/
create-release.yml
File metadata and controls
133 lines (116 loc) · 4.27 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Create Release
concurrency:
group: ci-${{ github.repository }}-release
cancel-in-progress: false
on:
push:
branches:
- "main"
paths-ignore:
- "docs/**"
- "CHANGELOG.md"
- "README.md"
env:
IMAGE_NAME: "${{ github.repository_owner }}/github-actions-runner"
jobs:
create_release:
uses: fullstack-devops/git-workflows/.github/workflows/create-release.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
load_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
- id: set-matrix
working-directory: images
run: |
flavours=$(ls -I "base"| xargs echo | sed 's/ /,/g')
echo "Building flavours: $flavours"
flavours="{\"flavour\":[\"`echo "$flavours" | sed 's/,/","/g'`\"]}"
echo "matrix=$flavours" >> $GITHUB_OUTPUT
build_base:
runs-on: ubuntu-latest
needs: create_release
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Red Hat Quay
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.RH_QUAY_USERNAME }}
password: ${{ secrets.RH_QUAY_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build github-actions-runner:base
uses: docker/build-push-action@v4
with:
context: ./images/base
push: true
tags: |
ghcr.io/${{ env.IMAGE_NAME }}:latest
ghcr.io/${{ env.IMAGE_NAME }}:latest-base
ghcr.io/${{ env.IMAGE_NAME }}:${{needs.create_release.outputs.version}}-base
quay.io/${{ env.IMAGE_NAME }}:latest
quay.io/${{ env.IMAGE_NAME }}:latest-base
quay.io/${{ env.IMAGE_NAME }}:${{needs.create_release.outputs.version}}-base
build_flavours:
runs-on: ubuntu-latest
needs: [create_release, load_matrix, build_base]
strategy:
matrix: ${{ fromJson(needs.load_matrix.outputs.matrix) }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Login to Red Hat Quay
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.RH_QUAY_USERNAME }}
password: ${{ secrets.RH_QUAY_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: link child image to current version
run: |
sed -i --expression "s@FROM ghcr.io/${{ env.IMAGE_NAME }}.*@FROM ghcr.io/${{ env.IMAGE_NAME }}:${{needs.create_release.outputs.version}}-base@g" \
images/${{ matrix.flavour }}/Dockerfile
- name: Build github-actions-runner:${{ matrix.flavour }}
uses: docker/build-push-action@v4
with:
context: ./images/${{ matrix.flavour }}
push: true
tags: |
quay.io/${{ env.IMAGE_NAME }}:latest-${{ matrix.flavour }}
quay.io/${{ env.IMAGE_NAME }}:${{needs.create_release.outputs.version}}-${{ matrix.flavour }}
publish_release:
runs-on: ubuntu-latest
needs: [create_release, build_base, build_flavours]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup awesome-ci
uses: fullstack-devops/awesome-ci-action@main
- name: Publish Release
run: awesome-ci release publish --release-id ${{ needs.create_release.outputs.releaseid }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: update helm charts appVersion
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.HELM_REPO_TOKEN }}
repository: fullstack-devops/helm-charts
event-type: update_chart_version
client-payload: '{"chart": "github-actions-runner", "version": "${{ needs.create_release.outputs.version }}"}'