fix: use minio operator namespace to assemble CA bundle #117
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
env: | |
image_base: benfiola/minio-operator-ext | |
concurrency: | |
group: ${{github.workflow}}-version | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: download versionctl | |
run: | | |
curl -fsSL -o /usr/local/bin/versionctl "https://github.com/benfiola/versionctl/releases/latest/download/versionctl-linux-amd64" | |
chmod +x /usr/local/bin/versionctl | |
- name: calculate facts | |
id: facts | |
run: | | |
versionctl next | |
version="$(versionctl next)" | |
tag="$(versionctl convert "${version}" git)" | |
docker_tag="$(versionctl convert "${version}" docker)" | |
docker_image="docker.io/${{env.image_base}}:${docker_tag}" | |
docker_image_latest="docker.io/${{env.image_base}}:latest" | |
is_main="0" | |
if [ "${{github.ref}}" = "refs/heads/main" ]; then | |
is_main="1" | |
fi | |
echo "docker_image=${docker_image}" >> "${GITHUB_OUTPUT}" | |
echo "docker_image_latest=${docker_image_latest}" >> "${GITHUB_OUTPUT}" | |
echo "is_main=${is_main}" >> "${GITHUB_OUTPUT}" | |
echo "tag=${tag}" >> "${GITHUB_OUTPUT}" | |
echo "version=${version}" >> "${GITHUB_OUTPUT}" | |
- name: create git tag | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/${{steps.facts.outputs.tag}}', | |
sha: context.sha | |
}) | |
- name: generate code | |
run: | | |
echo "${{steps.facts.outputs.version}}" > internal/embed/version.txt | |
make generate | |
git diff --exit-code | |
- name: upload source artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
include-hidden-files: true | |
name: source | |
path: "*" | |
outputs: | |
docker_image: ${{steps.facts.outputs.docker_image}} | |
docker_image_latest: ${{steps.facts.outputs.docker_image_latest}} | |
is_main: ${{steps.facts.outputs.is_main}} | |
tag: ${{steps.facts.outputs.tag}} | |
version: ${{steps.facts.outputs.version}} | |
build-docker: | |
needs: [prepare] | |
runs-on: ubuntu-latest | |
steps: | |
- name: download source artifact | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: source | |
path: . | |
merge-multiple: true | |
- name: build image tar | |
run: | | |
docker buildx create --platform=linux/arm64,linux/amd64 --use | |
docker buildx build --platform=linux/arm64,linux/amd64 --progress=plain --output type=oci,dest=docker.tar . | |
- name: upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: docker | |
path: docker.tar | |
build-helm-charts: | |
needs: [prepare] | |
strategy: | |
matrix: | |
chart: [crds, operator] | |
runs-on: ubuntu-latest | |
steps: | |
- name: download source | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: source | |
path: . | |
merge-multiple: true | |
- name: download helm | |
run: | | |
curl -fsSL -o /tmp/archive.tar.gz https://get.helm.sh/helm-v3.16.2-linux-amd64.tar.gz | |
tar xvzf /tmp/archive.tar.gz -C /usr/local/bin --strip-components 1 | |
rm -rf /tmp/archive.tar.gz | |
- name: package chart | |
run: | | |
helm package charts/${{matrix.chart}} --version "${{needs.prepare.outputs.version}}" --app-version "${{needs.prepare.outputs.version}}" | |
- name: upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: helm-charts-${{matrix.chart}} | |
path: ${{matrix.chart}}-${{needs.prepare.outputs.version}}.tgz | |
build-helm-docs: | |
needs: [prepare, build-helm-charts] | |
strategy: | |
matrix: | |
chart: [crds, operator] | |
runs-on: ubuntu-latest | |
steps: | |
- name: download helm-docs | |
run: | | |
curl -fsSL -o /tmp/archive.tar.gz https://github.com/norwoodj/helm-docs/releases/download/v1.14.2/helm-docs_1.14.2_Linux_x86_64.tar.gz | |
tar xvzf /tmp/archive.tar.gz -C /usr/local/bin | |
rm -rf /tmp/archive.tar.gz | |
- name: download chart | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: helm-charts-${{matrix.chart}} | |
path: . | |
merge-multiple: true | |
- name: generate chart docs | |
run: | | |
tar xvzf ${{matrix.chart}}-${{needs.prepare.outputs.version}}.tgz --strip-components 1 | |
helm-docs -o README-${{matrix.chart}}.md | |
- name: upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: helm-docs-${{matrix.chart}} | |
path: README-${{matrix.chart}}.md | |
publish-docker: | |
runs-on: ubuntu-latest | |
needs: [prepare, build-docker] | |
environment: | |
name: publish | |
steps: | |
- name: download crane | |
run: | | |
curl -o /tmp/archive.tar.gz -fsSL https://github.com/google/go-containerregistry/releases/download/v0.20.2/go-containerregistry_Linux_x86_64.tar.gz | |
tar xvzf /tmp/archive.tar.gz -C /usr/local/bin | |
rm -rf /tmp/archive.tar.gz | |
- name: download docker artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: docker | |
path: . | |
merge-multiple: true | |
- name: prepare for publish | |
run: | | |
mkdir -p /tmp/archive | |
tar xvf docker.tar -C /tmp/archive | |
crane auth login docker.io --username=benfiola --password='${{secrets.DOCKER_TOKEN}}' | |
- name: publish docker image | |
run: | | |
crane push /tmp/archive "${{needs.prepare.outputs.docker_image}}" | |
- name: publish latest docker image latest | |
if: "${{needs.prepare.outputs.is_main == '1'}}" | |
run: | | |
crane push /tmp/archive "${{needs.prepare.outputs.docker_image_latest}}" | |
- name: cleanup | |
run: | | |
rm -rf /tmp/archive | |
publish-helm: | |
runs-on: ubuntu-latest | |
needs: [prepare, build-helm-charts, build-helm-docs, publish-docker] | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- name: download helm | |
run: | | |
curl -fsSL -o /tmp/archive.tar.gz https://get.helm.sh/helm-v3.16.2-linux-amd64.tar.gz | |
tar xvzf /tmp/archive.tar.gz -C /usr/local/bin --strip-components 1 | |
rm -rf /tmp/archive.tar.gz | |
- name: checkout github pages branch | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
fetch-depth: 0 | |
- name: download helm artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: helm-charts-* | |
path: charts | |
merge-multiple: true | |
- name: download helm chart artifacts | |
uses: actions/download-artifact@v4 | |
if: "${{needs.prepare.outputs.is_main == '1'}}" | |
with: | |
pattern: helm-charts-* | |
path: charts | |
merge-multiple: true | |
- name: regenerate helm repo index | |
run: | | |
cd charts | |
helm repo index . --url https://benfiola.github.io/minio-operator-ext/charts | |
- name: commit and push updated helm repo to github pages branch | |
run: | | |
git config --global user.name 'Ben Fiola' | |
git config --global user.email '[email protected]' | |
git remote set-url origin https://x-access-token:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}} | |
git add -A | |
git commit -am "Added charts for version ${{needs.prepare.outputs.version}}" | |
git push origin | |
release: | |
runs-on: ubuntu-latest | |
needs: [prepare, publish-docker, publish-helm] | |
permissions: | |
id-token: write | |
contents: write | |
environment: | |
name: publish | |
steps: | |
- name: release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body: | | |
Published docker image: `${{needs.prepare.outputs.docker_image}}`. | |
Published helm charts version: `${{needs.prepare.outputs.version}}`. | |
files: | | |
artifacts/* | |
make_latest: ${{needs.prepare.outputs.is_main == '1'}} | |
prerelease: ${{needs.prepare.outputs.is_main != '1'}} | |
tag_name: ${{needs.prepare.outputs.tag}} | |
target_commitish: ${{github.sha}} |