Switch to composite actions (Forgejo 11 lacks workflow_call)
This commit is contained in:
parent
46bcafb9cb
commit
753a3b37de
6 changed files with 141 additions and 118 deletions
40
gitops-bump/action.yaml
Normal file
40
gitops-bump/action.yaml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
name: gitops-bump
|
||||
description: >
|
||||
Points the app's kustomize overlay in the gitops repo at the image tag
|
||||
just pushed (short sha of the triggering commit); ArgoCD picks up the
|
||||
commit and deploys. Run on the `host` runner label (git + kustomize
|
||||
installed there).
|
||||
inputs:
|
||||
app-name:
|
||||
description: App name (dir under manifests/ and kustomize image name)
|
||||
required: true
|
||||
gitops-repo:
|
||||
description: owner/name of the gitops repo
|
||||
required: false
|
||||
default: nholtware/gitops
|
||||
gitops-token:
|
||||
description: Token with write access to the gitops repo (pass secrets.GITOPS_TOKEN)
|
||||
required: true
|
||||
registry:
|
||||
description: Registry host:port (must match build-push)
|
||||
required: false
|
||||
default: "192.168.1.230:3000"
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- shell: bash
|
||||
env:
|
||||
GITOPS_TOKEN: ${{ inputs.gitops-token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
TAG="${GITHUB_SHA:0:8}"
|
||||
IMAGE="${{ inputs.registry }}/$GITHUB_REPOSITORY_OWNER/${{ inputs.app-name }}"
|
||||
DIR="$(mktemp -d)"
|
||||
trap 'rm -rf "$DIR"' EXIT
|
||||
git clone --depth 1 "http://ci-bot:${GITOPS_TOKEN}@192.168.1.230:3000/${{ inputs.gitops-repo }}.git" "$DIR"
|
||||
cd "$DIR/manifests/${{ inputs.app-name }}"
|
||||
kustomize edit set image "${{ inputs.app-name }}=$IMAGE:$TAG"
|
||||
cd "$DIR"
|
||||
git -c user.name=ci-bot -c user.email=ci-bot@forgejo.local \
|
||||
commit -am "${{ inputs.app-name }}: deploy $TAG" || { echo "tag unchanged, nothing to deploy"; exit 0; }
|
||||
git push
|
||||
Loading…
Add table
Add a link
Reference in a new issue