Skip to content

Release OpenCTI chart #24

Release OpenCTI chart

Release OpenCTI chart #24

Workflow file for this run

name: Release charts
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "opencti/**"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Get chart verison
id: chart_version
run: |
echo "CHART_VERSION=$(cat opencti/Chart.yaml | awk -F"[ ',]+" '/version:/{print $2}' | head -1)" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: tag_exists
run: |
TAG_EXISTS=true
if ! [ $(git tag -l "v${{ steps.chart_version.outputs.CHART_VERSION }}") ]; then
TAG_EXISTS=false
fi
echo TAG_EXISTS=$TAG_EXISTS >> $GITHUB_OUTPUT
- name: Tag release
id: tag_version
uses: mathieudutour/[email protected]
with:
custom_tag: ${{ steps.chart_version.outputs.CHART_VERSION }}
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: v
- name: Run chart-releaser
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
uses: helm/[email protected]
with:
config: cr.yaml
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Login in to the Container registry
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install Cosign
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
uses: sigstore/cosign-installer@v3
- name: Install Oras
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
uses: oras-project/setup-oras@v1
# ref: https://github.com/backstage/charts/blob/88240ce7a0726e3773ee0e4866fbe6325c15267b/.github/workflows/release.yml#L50
- name: Publish and Sign OCI Charts
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
run: |
for chart in `find .cr-release-packages -name '*.tgz' -print`; do
helm push ${chart} oci://ghcr.io/${GITHUB_REPOSITORY} |& tee helm-push-output.log
file_name=${chart##*/}
chart_name=${file_name%-*}
digest=$(awk -F "[, ]+" '/Digest/{print $NF}' < helm-push-output.log)
cosign sign -y "ghcr.io/${GITHUB_REPOSITORY}/${chart_name}@${digest}"
oras push "ghcr.io/${GITHUB_REPOSITORY}/${chart_name}:${{ steps.chart_version.outputs.CHART_VERSION }}"
done
env:
COSIGN_EXPERIMENTAL: 1