[pre-commit.ci] pre-commit autoupdate #382
This file contains hidden or 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: Publish artifacts | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: | |
| - 'main' | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| 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: Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=sha,format=long | |
| type=semver,pattern=v{{version}} | |
| type=semver,pattern=v{{major}}.{{minor}} | |
| type=semver,pattern=v{{major}} | |
| # 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: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| # hardcoding while it's runnin off main | |
| # tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v0 | |
| # 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 "[email protected]" | |
| # | |
| # - name: Install uv | |
| # uses: astral-sh/setup-uv@v5 | |
| # with: | |
| # version: "0.5.13" | |
| # 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 fcm tools update-helm-chart-version ${{ github.ref }} ${{ steps.commit_count.outputs.commit_count }} | |
| # env: | |
| # SKIP_SLACK_APP_INIT: ya | |
| # | |
| # - name: Install Helm | |
| # uses: azure/setup-helm@v4 | |
| # env: | |
| # GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| # | |
| # - name: Run chart-releaser | |
| # uses: helm/[email protected] | |
| # if: ${{ github.event_name != 'pull_request' && github.ref != 'refs/heads/main' }} | |
| # env: | |
| # CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |