Skip to content

[pre-commit.ci] pre-commit autoupdate (#7) #33

[pre-commit.ci] pre-commit autoupdate (#7)

[pre-commit.ci] pre-commit autoupdate (#7) #33

Workflow file for this run

name: Publish artifacts
on:
push:
#branches: ['release']
branches: ['main']
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
# publish helm chart
# TODO - when should we publish? always on main? could be out of sync with image
# need to figure out that release strategy
publish-helm-chart:
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# is this still needed?
# using API for commit count
# this may be needed for tags and building index.yaml
with:
fetch-depth: 0
# TODO - github. variables https://docs.github.com/en/actions/writing-workflows/quickstart
# https://gist.github.com/0penBrain/7be59a48aba778c955d992aa69e524c5 it's fine
- name: Pull git commit count
id: commit_count
run: |
COMMIT_COUNT=$(curl -I -k "https://api.github.com/repos/${{ github.repository }}/commits?per_page=1&sha=${{ github.sha }}" | sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p')
echo commit_count=$COMMIT_COUNT >> "$GITHUB_OUTPUT"
echo $COMMIT_COUNT
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install the project
run: uv sync
- name: Update Helm version
run: uv run workflows tools update-helm-chart-version ${{ steps.commit_count.outputs.commit_count }}
- name: Install Helm
uses: azure/setup-helm@v4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
#tags: ${{ steps.meta.outputs.tags }}
#labels: ${{ steps.meta.outputs.labels }}
# hardcoding while it's runnin off main
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest