Repository navigation
164 lines (145 loc) · 5.92 KB
/
Copy pathrelease.yaml
File metadata and controls
164 lines (145 loc) · 5.92 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This workflow creates a GitHub Release and publishes the Helm chart to the
# Apache JFrog Artifactory Helm OCI repository.
#
# Triggers:
# - push of a v* tag (a human or PAT push; GITHUB_TOKEN tag pushes do not fire this)
# - workflow_call from Tag Release on Version Update after an auto-update merge
# - workflow_dispatch for an existing tag (recover a missed publish)
#
# Publishing uses JFrog CLI (`jf helm`) so the chart push is tied to Artifactory
# build-info: CI environment and Git metadata are attached, then the build is
# published for traceability (Builds UI, Xray, promotion flows, etc.).
#
# Required GitHub Secrets:
# ARTIFACTORY_USERNAME -- Apache JFrog Artifactory username
# ARTIFACTORY_PASSWORD -- Apache JFrog Artifactory password
#
# Prerequisite: The Helm OCI repository must exist in Apache JFrog (Tika project), e.g. tika-helm.
# Confirm the repo key and project with Apache Infra and set HELM_OCI_REPO / JF_PROJECT_KEY if different.
#
# JFrog CLI is installed via .github/actions/setup-jfrog-cli-manual (cached download from
# releases.jfrog.io) because jfrog/setup-jfrog-cli is not in ASF approved_patterns.yml.
name: Release Helm Chart
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Existing git tag to release'
required: true
type: string
workflow_call:
inputs:
tag:
description: 'Existing git tag to release'
required: true
type: string
secrets:
ARTIFACTORY_USERNAME:
required: true
ARTIFACTORY_PASSWORD:
required: true
permissions:
contents: write
env:
JF_URL: https://apache.jfrog.io
HELM_OCI_REPO: tika-helm
JF_PROJECT_KEY: tika
JF_BUILD_NAME: tika-helm
JF_BUILD_NUMBER: ${{ github.run_id }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Resolve release tag
id: rel
run: |
TAG="${{ inputs.tag }}"
if [ -z "$TAG" ]; then
TAG="${GITHUB_REF_NAME}"
fi
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
shell: bash
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ steps.rel.outputs.tag }}
fetch-depth: 0
fetch-tags: true
- name: Extract versions from Chart.yaml
id: versions
run: |
CHART_VERSION=$(grep '^version:' Chart.yaml | sed 's/version: *"\(.*\)"/\1/')
APP_VERSION=$(grep '^appVersion:' Chart.yaml | sed 's/appVersion: *"\(.*\)"/\1/')
echo "chart_version=$CHART_VERSION" >> "$GITHUB_OUTPUT"
echo "app_version=$APP_VERSION" >> "$GITHUB_OUTPUT"
shell: bash
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.rel.outputs.tag }}
name: "tika-helm ${{ steps.rel.outputs.tag }}"
body: |
## tika-helm ${{ steps.rel.outputs.tag }}
**Chart version:** `${{ steps.versions.outputs.chart_version }}`
**App version (Docker image tag):** `${{ steps.versions.outputs.app_version }}`
**Install from Helm OCI:** `helm install tika oci://apache.jfrog.io/${{ env.HELM_OCI_REPO }}/tika --version ${{ steps.versions.outputs.chart_version }}`
**Artifactory build:** `${{ env.JF_BUILD_NAME }}` / `${{ env.JF_BUILD_NUMBER }}` (project `${{ env.JF_PROJECT_KEY }}`)
[View available tags on Docker Hub](https://hub.docker.com/r/apache/tika/tags)
generate_release_notes: true
draft: false
prerelease: false
- name: Set up Helm
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
- name: Set up JFrog CLI
uses: ./.github/actions/setup-jfrog-cli-manual
with:
jfrog-url: ${{ env.JF_URL }}
version: '2.92.0'
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Package Helm chart
run: helm package . --version ${{ steps.versions.outputs.chart_version }}
shell: bash
- name: Log in to Helm OCI registry (JFrog CLI)
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
run: >-
jf helm registry login apache.jfrog.io
--username "$ARTIFACTORY_USERNAME"
--password "$ARTIFACTORY_PASSWORD"
shell: bash
- name: Push Helm chart (JFrog CLI, build-info)
env:
CHART_VERSION: ${{ steps.versions.outputs.chart_version }}
run: |
jf helm push "tika-${CHART_VERSION}.tgz" \
"oci://apache.jfrog.io/${HELM_OCI_REPO}" \
--build-name="${JF_BUILD_NAME}" \
--build-number="${JF_BUILD_NUMBER}" \
--project="${JF_PROJECT_KEY}"
shell: bash
- name: Enrich and publish build info
run: |
jf rt build-collect-env "${JF_BUILD_NAME}" "${JF_BUILD_NUMBER}"
jf rt build-add-git "${JF_BUILD_NAME}" "${JF_BUILD_NUMBER}"
jf rt build-publish --project="${JF_PROJECT_KEY}" "${JF_BUILD_NAME}" "${JF_BUILD_NUMBER}"
shell: bash