Skip to content

Commit 189505f

Browse files
authored
chore: Add oci release support (#82)
1 parent bcf86f4 commit 189505f

File tree

6 files changed

+65
-14
lines changed

6 files changed

+65
-14
lines changed

.github/actions/publish/action.yml renamed to .github/actions/publish-gh-pages/action.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,28 @@ runs:
2424
echo "CHART_VERSION=$version" >> "$GITHUB_OUTPUT"
2525
echo "ARTIFACT=ld-relay-$version.tgz" >> "$GITHUB_OUTPUT"
2626
27+
- name: Make build directory
28+
shell: bash
29+
run: mkdir -p build
30+
2731
- name: Package the helm chart
2832
shell: bash
29-
run: |
30-
mkdir -p new-chart
31-
helm package -d new-chart .
33+
run: helm package -d build .
3234

3335
- name: Generate updated index.yaml
3436
shell: bash
35-
run: helm repo index new-chart --url https://launchdarkly.github.io/ld-relay-helm --merge helm-repo/index.yaml
37+
run: helm repo index build --url https://launchdarkly.github.io/ld-relay-helm --merge helm-repo/index.yaml
3638

3739
- name: Move files into publishable directory
3840
shell: bash
39-
run: mv new-chart/${{ steps.version.outputs.ARTIFACT }} new-chart/index.yaml helm-repo
40-
run: mv helm-repo/*tgz new-chart/
41+
run: mv build/${{ steps.version.outputs.ARTIFACT }} build/index.yaml helm-repo
42+
run: mv helm-repo/*tgz build/
4143

4244
- name: Publish to GitHub pages
4345
if: ${{ inputs.dry_run == 'false' }}
4446
uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.2
4547
with:
46-
docs_path: new-chart
48+
docs_path: build
4749
github_token: ${{ inputs.token }}
4850

4951
- name: Attach published chart to release
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Chart
2+
description: "Publish to gh-pages-backed chart repository"
3+
inputs:
4+
dry_run:
5+
description: "Is this a dry run. If so no package will be published."
6+
required: true
7+
token:
8+
description: "The GitHub token used to upload artifacts to the published release"
9+
required: true
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Login to GitHub Container Registry
17+
uses: docker/login-action@v3.6.0
18+
with:
19+
registry: ghcr.io
20+
username: ${{ github.actor }}
21+
password: ${{ inputs.token }}
22+
23+
- name: Make build directory
24+
shell: bash
25+
run: mkdir -p build
26+
27+
- name: Package the helm chart
28+
shell: bash
29+
run: helm package -d build .
30+
31+
- name: Push chart to GHCR
32+
if: ${{ inputs.dry_run == 'false' }}
33+
shell: bash
34+
run: helm push build/ld-relay-*.tgz oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/helm-charts

.github/workflows/manual-publish.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_dispatch:
44
inputs:
55
dry_run:
6-
description: 'Is this a dry run? If so no package will be published.'
6+
description: "Is this a dry run? If so no package will be published."
77
type: boolean
88
required: true
99

@@ -12,8 +12,9 @@ jobs:
1212
runs-on: ubuntu-latest
1313
# Needed to get tokens during publishing.
1414
permissions:
15-
id-token: write
16-
contents: write
15+
id-token: write # Needed if using OIDC to get release secrets.
16+
contents: write # Contents and pull-requests are for release-please to make releases.
17+
packages: write # needed for ghcr access
1718
steps:
1819
- uses: actions/checkout@v4
1920

@@ -22,7 +23,12 @@ jobs:
2223
- name: Run quality control checks
2324
uses: ./.github/actions/ci
2425

25-
- uses: ./.github/actions/publish
26+
- uses: ./.github/actions/publish-gh-pages
27+
with:
28+
dry_run: ${{ inputs.dry_run }}
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- uses: ./.github/actions/publish-ghcr
2632
with:
2733
dry_run: ${{ inputs.dry_run }}
2834
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-please.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ name: Run Release Please
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66

77
jobs:
88
release-package:
99
runs-on: ubuntu-latest
1010
permissions:
1111
id-token: write # Needed if using OIDC to get release secrets.
1212
contents: write # Contents and pull-requests are for release-please to make releases.
13+
packages: write # needed for ghcr access
1314
pull-requests: write
1415
steps:
1516
- uses: googleapis/release-please-action@v4
@@ -27,7 +28,13 @@ jobs:
2728
if: ${{ steps.release.outputs.releases_created == 'true' }}
2829
uses: ./.github/actions/ci
2930

30-
- uses: ./.github/actions/publish
31+
- uses: ./.github/actions/publish-gh-pages
32+
if: ${{ steps.release.outputs.releases_created == 'true' }}
33+
with:
34+
dry_run: false
35+
token: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- uses: ./.github/actions/publish-ghcr
3138
if: ${{ steps.release.outputs.releases_created == 'true' }}
3239
with:
3340
dry_run: false

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ unittest: #! Run the unit tests
1919

2020
.PHONY: lint
2121
lint: #! Run helm lint against this chart
22-
@helm lint
22+
@helm lint .
2323

2424
.PHONY: package
2525
package: #! Build the helm package (e.g. ld-relay-x.y.z.tgz)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ helm install ld-relay --set relay.environment.LD_ENV_YourEnvironment=your-sdk-ke
3131

3232
For additional configuration, use the [Configuration options](#configuration-options) below.
3333

34+
OCI artifacts of all LaunchDarkly Helm charts are available in [ghcr.io](https://github.com/orgs/launchdarkly/packages?q=helm-charts).
35+
3436
## Configuration options
3537

3638
To customize this Helm chart, override the configuration options defined in the [values file](https://github.com/launchdarkly/ld-relay-helm/blob/main/values.yaml). The values file contains detailed documentation on each option.

0 commit comments

Comments
 (0)