Skip to content

platform: v0.8.3

platform: v0.8.3 #31

Workflow file for this run

name: Release Charts
on:
release:
types: [published]
jobs:
release:
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.AUTOMATION_KEY }}
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "opentdf-automation[bot]"
git config user.email "416599+opentdf-automation[bot]@users.noreply.github.com"
- id: 'download-helm'
shell: bash
working-directory: '${{ runner.temp }}'
env:
HELM_VERSION: 'v3.14.4' # v3.14.4 = April 10 2024
HELM_SHA256SUM: 'a5844ef2c38ef6ddf3b5a8f7d91e7e0e8ebc39a38bb3fc8013d629c1ef29c259'
run: |
curl -sSLO "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz"
echo "${HELM_SHA256SUM} helm-${HELM_VERSION}-linux-amd64.tar.gz" | sha256sum -c --quiet --strict
mkdir -p helm
tar xf "helm-${HELM_VERSION}-linux-amd64.tar.gz" -C helm
mkdir -p "$HOME/.local/bin"
mv ./helm/linux-amd64/helm "$HOME/.local/bin"
helm version
- name: Run chart-releaser
uses: helm/chart-releaser-action@d1e09fd16821c091b45aa754f65bae4dd675d425
env:
CR_TOKEN: "${{ steps.app-token.outputs.token }}"
with:
skip_upload: true
skip_existing: true
- name: Upload Chart to Release
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: gh release upload ${{github.event.release.tag_name}} ./.cr-release-packages/*.tgz
- name: Generate Index
run: cr index -o ${{github.repository_owner}} -r ${{ github.event.repository.name }} -t ${{steps.app-token.outputs.token}} -i ./index.yaml
- name: Upload Index
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
const fs = require('fs');
try {
// Read the index.yaml file
const content = fs.readFileSync('index.yaml', 'utf8');
// Get the current file (if it exists) to get its SHA
let fileSha;
try {
const { data: file } = await github.rest.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: 'index.yaml',
ref: 'main'
});
fileSha = file.sha;
} catch (e) {
// File doesn't exist yet, that's ok
console.log('No existing index.yaml found');
}
// Create or update the file
await github.rest.repos.createOrUpdateFileContents({
owner: context.repo.owner,
repo: context.repo.repo,
path: 'index.yaml',
message: 'Update index.yaml',
content: Buffer.from(content).toString('base64'),
sha: fileSha,
branch: 'main'
});
console.log('Successfully updated index.yaml');
} catch (error) {
console.log('Error:', error);
core.setFailed(error.message);
}