mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-11-20 08:40:46 +01:00
Mutable action tags are a supply-chain risk: a moved tag runs different code without a diff. Every workflow action is now pinned through .github/workflows/actions.lock, and CI verifies the lockfile so an out-of-sync or tampered one fails instead of running.
87 lines
2.6 KiB
YAML
87 lines
2.6 KiB
YAML
name: build-docker-image
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "[0-2].[0-9]+.[0-9]+*"
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
build-and-push-image:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Harden runner
|
|
uses: step-security/harden-runner@v2.22.4
|
|
with:
|
|
egress-policy: audit
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4.4.0
|
|
|
|
# For multi platform build. See https://docs.docker.com/build/ci/github-actions/multi-platform/
|
|
- name: Set up QEMU
|
|
uses: step-security/setup-qemu-action@v3.7.0
|
|
- name: Set up Docker Buildx
|
|
uses: step-security/setup-buildx-action@v3.12.0
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: step-security/metadata-action@v6.2.0
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
- name: Login to Container Registry
|
|
uses: step-security/docker-login-action@v3.7.0
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.PAT }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: step-security/docker-build-push-action@v7.4.0
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64
|
|
chart-release:
|
|
runs-on: ubuntu-20.04
|
|
needs: build-and-push-image
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Harden runner
|
|
uses: step-security/harden-runner@v2.22.4
|
|
with:
|
|
egress-policy: audit
|
|
- name: Checkout
|
|
uses: actions/checkout@v4.4.0
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Configure Git
|
|
run: |
|
|
git config user.name "$GITHUB_ACTOR"
|
|
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
|
- name: Install Helm
|
|
uses: step-security/setup-helm@v5.0.1
|
|
- name: sed
|
|
run: |
|
|
sed -i "s/CHART_VERSION/${{ github.ref_name }}/" charts/irsa-manager/Chart.yaml
|
|
sed -i "s/APP_VERSION/${{ github.ref_name }}/" charts/irsa-manager/Chart.yaml
|
|
sed -i "s/APP_VERSION/${{ github.ref_name }}/" charts/irsa-manager/values.yaml
|
|
- name: Run chart-releaser
|
|
uses: step-security/chart-releaser-action@v1.7.0
|
|
with:
|
|
config: cr.yaml
|
|
env:
|
|
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|