parameterize build for yamls to update
All checks were successful
Build Container and update Flux / Explore-Gitea-Actions (push) Successful in 35s
All checks were successful
Build Container and update Flux / Explore-Gitea-Actions (push) Successful in 35s
fix flux.yaml in main add buildah
This commit is contained in:
parent
5b77155140
commit
1f56aad5c4
47
.github/workflows/build.yaml
vendored
47
.github/workflows/build.yaml
vendored
|
@ -1,9 +1,13 @@
|
|||
name: Github Actions Demo
|
||||
run-name: ${{ github.actor }} is testing out GitHub Actions (on Gitea) 🚀
|
||||
name: Build Container and update Flux
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- k/**
|
||||
branches:
|
||||
- '*'
|
||||
- '!k-*'
|
||||
|
||||
env:
|
||||
DEPLOY_MANIFEST: "${{ vars.DEPLOY_MANIFEST || 'deploy.yaml' }}"
|
||||
FLUX_MANIFEST: "${{ vars.FLUX_MANIFEST || 'flux.yaml' }}"
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
|
@ -21,14 +25,35 @@ jobs:
|
|||
docker tag "`cat iid.txt`" "$DOCKER_REGISTRY/$GITHUB_REPOSITORY:$TAG"
|
||||
docker push "$DOCKER_REGISTRY/$GITHUB_REPOSITORY:$TAG"
|
||||
done
|
||||
git checkout -B k-$GITHUB_REF_NAME
|
||||
git checkout $GITHUB_REF_NAME
|
||||
git branch -D k-$GITHUB_REF_NAME
|
||||
git checkout -b k-$GITHUB_REF_NAME
|
||||
sed -i -e "s@image: $DOCKER_REGISTRY/$GITHUB_REPOSITORY:.*@image: $DOCKER_REGISTRY/$GITHUB_REPOSITORY:$STAG@" k/runner.yaml
|
||||
sed -i -e "s@branch: .*@k-$GITHUB_REF_NAME@" k/flux.yaml
|
||||
|
||||
BRANCH="$GITHUB_REF_NAME"
|
||||
KBRANCH="k-$GITHUB_REF_NAME"
|
||||
|
||||
git config user.name "$GITHUB_REPOSITORY (act)"
|
||||
git config user.email "gitea-actions@strudelline.net"
|
||||
|
||||
# let's fix the origin branch's flux.yaml if it's needed.
|
||||
# this will only happen once so it's not such an awful UX.
|
||||
sed -i -e "s@branch: .*@branch: $KBRANCH@" "k/$FLUX_MANIFEST"
|
||||
|
||||
if git diff | grep -q .;then
|
||||
echo fixing branch in flux.yaml of the origin branch
|
||||
git add "k/$FLUX_MANIFEST"
|
||||
git commit -m "fix $FLUX_MANIFEST in $BRANCH"
|
||||
fi
|
||||
|
||||
# ensure the k-branch exists so we can ensure it's deleted. no errors at all.
|
||||
git checkout -B "$KBRANCH"
|
||||
git checkout "$BRANCH"
|
||||
git branch -D "$KBRANCH"
|
||||
git checkout -b "$KBRANCH"
|
||||
|
||||
# now fix up the images in k/runner.yaml
|
||||
sed -i -e "s@image: $DOCKER_REGISTRY/$GITHUB_REPOSITORY:.*@image: $DOCKER_REGISTRY/$GITHUB_REPOSITORY:$STAG@" "k/$DEPLOY_MANIFEST"
|
||||
|
||||
git add k
|
||||
git commit -m "upgrade runner sts to $STAG"
|
||||
git push -f origin k-$GITHUB_REF_NAME
|
||||
|
||||
# now, since we've made it here, we'll push both, k-branch forced because it's supposed to overwrite history
|
||||
git push -f origin "$KBRANCH"
|
||||
git push origin "$BRANCH"
|
||||
|
|
|
@ -6,6 +6,7 @@ RUN apk add \
|
|||
nodejs \
|
||||
tea \
|
||||
curl \
|
||||
buildah \
|
||||
--no-cache
|
||||
|
||||
USER rootless
|
||||
|
|
Loading…
Reference in New Issue
Block a user