Add new workflow with docker images #1
This file contains 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: Release Docker images and Helm Chart | |
# see https://github.com/helm/chart-releaser-action | |
on: | |
workflow_dispatch: { } | |
push: | |
branches: | |
- "main" | |
env: | |
DOCKER_IMAGE_NAME: mimirrules | |
DOCKER_BUILD_DIR: '.' | |
permissions: {} | |
jobs: | |
release: | |
permissions: | |
contents: write # to push chart release and create a release (helm/chart-releaser-action) | |
packages: write # needed for ghcr access | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Get metadata for Docker image | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: | | |
ghcr.io/${{ github.repository }}/${{ env.DOCKER_IMAGE_NAME }} | |
tags: | | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=ref,event=tag | |
type=ref,event=branch | |
type=sha | |
- name: Log in to the GitHub Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and if not a PR push to Github Packages | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ env.DOCKER_BUILD_DIR }} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
with: | |
charts_dir: charts | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
CR_SKIP_EXISTING: "true" | |
# - name: Push charts to GHCR | |
# run: | | |
# shopt -s nullglob | |
# for pkg in .cr-release-packages/*; do | |
# [ -z "${pkg:-}" ] && break | |
# helm push "${pkg}" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts" && echo '::warning:: helm push failed!' | |
# done |