James Andariese
9ba8c8f829
All checks were successful
Github Actions Demo / Explore-Gitea-Actions (push) Successful in 6s
the history changing on every commit felt very yucky.
35 lines
1.4 KiB
YAML
35 lines
1.4 KiB
YAML
name: Github Actions Demo
|
|
run-name: ${{ github.actor }} is testing out GitHub Actions (on Gitea) 🚀
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- k/**
|
|
|
|
jobs:
|
|
Explore-Gitea-Actions:
|
|
runs-on: metal-docker
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v3
|
|
- run: |
|
|
ls -la
|
|
docker build --progress plain --iidfile iid.txt .
|
|
stringprefix() { [ ${#1} -le $2 ] && echo $1 && return 0 || stringprefix "${1%?}" $2 ; }
|
|
STAG="$GITHUB_REF_NAME-$(date +%Y-%m-%d-%H.%M.%S)"
|
|
SHORTSHA="$(stringprefix "$GITHUB_SHA" 8)"
|
|
for TAG in "$SHORTSHA" "$GITHUB_REF_NAME" "$STAG";do
|
|
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
|
|
git config user.name "$GITHUB_REPOSITORY (act)"
|
|
git config user.email "gitea-actions@strudelline.net"
|
|
git add k/runner.yaml
|
|
git commit -m "upgrade runner sts to $STAG"
|
|
git push -f origin k-$GITHUB_REF_NAME
|