Skip to content

Commit

Permalink
First release (#1)
Browse files Browse the repository at this point in the history
First release
  • Loading branch information
theshell76 authored Sep 27, 2024
1 parent a463719 commit 9324f06
Show file tree
Hide file tree
Showing 60 changed files with 2,552 additions and 396 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/publish-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Publish helm chart
run-name: Publish helm chart

on:
push:
tags: ["chart-*"]
branches: ['main', 'devel']
paths: ['chart/**']

env:
CHART_PATH: chart
UPDATE_DEPS: 'false'
# GitHub Container registry
GHCR_NAME: ${{ github.repository_owner }}/helm
# Docker Hub
# DHUB_NAME: insios-helm
# DHUB_USERNAME: ${{ secrets.INSIOS_DOCKER_USERNAME }}
# DHUB_PASSWORD: ${{ secrets.INSIOS_DOCKER_PASSWORD }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Helm
uses: azure/setup-helm@v4

- name: Extract metadata (chart name, tag)
id: meta
run: |
echo "name=$(helm show chart ${{ env.CHART_PATH }} | grep 'name:' | awk '{print $2}')" >> "$GITHUB_OUTPUT"
if [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "tag=$(echo '${{ github.ref_name }}' | awk -F '-' '{print $2}')" >> "$GITHUB_OUTPUT"
else
echo "tag=0.0.0-${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Build and push Helm chart to Container registry
uses: appany/helm-oci-chart-releaser@v0.4.2
with:
path: ${{ env.CHART_PATH }}
update_dependencies: '${{ env.UPDATE_DEPS }}'
name: ${{ steps.meta.outputs.name }}
tag: ${{ steps.meta.outputs.tag }}
registry: ghcr.io
registry_username: ${{ github.actor }}
registry_password: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ env.GHCR_NAME }}

# - name: Build and push Helm chart to Docker Hub
# uses: appany/helm-oci-chart-releaser@v0.4.2
# with:
# path: ${{ env.CHART_PATH }}
# update_dependencies: '${{ env.UPDATE_DEPS }}'
# name: ${{ steps.meta.outputs.name }}
# tag: ${{ steps.meta.outputs.tag }}
# registry: registry-1.docker.io
# registry_username: ${{ env.DHUB_USERNAME }}
# registry_password: ${{ env.DHUB_PASSWORD }}
# repository: ${{ env.DHUB_NAME }}
72 changes: 72 additions & 0 deletions .github/workflows/publish-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Publish docker image
run-name: Publish docker image

on:
push:
tags: ["app-*"]
branches: ['main', 'devel']
paths: ['app/**']

env:
APP_PATH: app
# GitHub Container registry
GHCR_NAME: ${{ github.repository_owner }}/docker/${{ github.event.repository.name }}
# Docker Hub
DHUB_NAME: insios/${{ github.event.repository.name }}
DHUB_USERNAME: ${{ secrets.INSIOS_DOCKER_USERNAME }}
DHUB_PASSWORD: ${{ secrets.INSIOS_DOCKER_PASSWORD }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DHUB_USERNAME }}
password: ${{ env.DHUB_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ env.GHCR_NAME }}
${{ env.DHUB_NAME }}
tags: |
type=ref,event=branch
type=match,pattern=app-(\d+.\d+.\d+),group=1
type=match,pattern=app-(\d+.\d+),group=1
type=match,pattern=app-(\d+),group=1
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: ${{ env.APP_PATH }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/${{ env.GHCR_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
Loading

0 comments on commit 9324f06

Please sign in to comment.