-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (115 loc) · 4.17 KB
/
publish-package.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
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
name: Publish Package
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
branches:
- main
workflow_dispatch:
jobs:
publish-package:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Carvel tools
shell: bash
run: curl -L https://carvel.dev/install.sh | bash
- name: Calculate variables
shell: bash
run: |
REPOSITORY_OWNER=${{github.repository_owner}}
echo "REPOSITORY_OWNER=${REPOSITORY_OWNER,,}" >>${GITHUB_ENV}
echo "REPOSITORY_TAG=${GITHUB_REF##*/}" >>${GITHUB_ENV}
echo "REPOSITORY_SHA_TAG=sha-${GITHUB_SHA::7}" >>${GITHUB_ENV}
- name: Create publish values file
shell: bash
run: |
cat <<EOF > publish-values.yaml
clusterIngress:
caCertificateRef:
namespace: default
name: ca-certificate
EOF
- name: Publish package bundle
shell: bash
run: |
# Create images lock file. We use a sample values file to pass validations
# We properly rewrite references to images via kbld
ytt --data-values-file publish-values.yaml -f bundle/config | \
kbld -f - --imgpkg-lock-output bundle/.imgpkg/images.yml
# Push the bundle to the registry
imgpkg push \
-b ghcr.io/${{env.REPOSITORY_OWNER}}/educates-lookup-service-installer:${{env.REPOSITORY_TAG}} \
--registry-username=${{github.actor}} \
--registry-password=${{secrets.GITHUB_TOKEN}} \
-f bundle
release-artifacts:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- publish-package
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Calculate variables
shell: bash
run: |
REPOSITORY_TAG=${GITHUB_REF##*/}
if [[ "$REPOSITORY_TAG" == *-* ]]; then
PRERELEASE=true
else
PRERELEASE=false
fi
echo "REPOSITORY_TAG=${REPOSITORY_TAG}" >>${GITHUB_ENV}
echo "PRERELEASE=${PRERELEASE}" >>${GITHUB_ENV}
- name: Generate YAML release files.
shell: bash
run: |
cp resources/rbac.yaml educates-lookup-service-installer-app-rbac.yaml
cat resources/app.yaml | sed -e "s/:main/:${{env.REPOSITORY_TAG}}/" > educates-lookup-service-installer-app.yaml
- name: Generate file checksums for CLI binaries
shell: bash
run: |
sha256sum educates-lookup-service-installer-app.yaml >> checksums.txt
sha256sum educates-lookup-service-installer-app-rbac.yaml >> checksums.txt
echo 'File Checksums' >> release-notes.md
echo '--------------' >> release-notes.md
echo '```' >> release-notes.md
cat checksums.txt >> release-notes.md
echo '```' >> release-notes.md
- uses: actions/upload-artifact@v4
with:
name: educates-lookup-service-installer-app.yaml
path: educates-lookup-service-installer-app.yaml
- uses: actions/upload-artifact@v4
with:
name: educates-lookup-service-installer-app-rbac.yaml
path: educates-lookup-service-installer-app-rbac.yaml
- uses: actions/upload-artifact@v4
with:
name: checksums.txt
path: checksums.txt
- uses: actions/upload-artifact@v4
with:
name: release-notes.md
path: release-notes.md
- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{env.REPOSITORY_TAG}}
name: "educates-lookup-service:${{env.REPOSITORY_TAG}}"
draft: false
prerelease: ${{env.PRERELEASE}}
body_path: release-notes.md
files: |
checksums.txt
educates-lookup-service-installer-app.yaml
educates-lookup-service-installer-app-rbac.yaml