2024-02-25 19:51:06 +00:00
|
|
|
name: Github Actions Demo
|
|
|
|
run-name: ${{ github.actor }} is testing out GitHub Actions (on Gitea) 🚀
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
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 ; }
|
|
|
|
SHORTSHA="$(stringprefix "$GITHUB_SHA" 8)"
|
2024-03-29 01:34:31 +00:00
|
|
|
for TAG in "$SHORTSHA" "$GITHUB_REF_NAME" "$GITHUB_REF_NAME-$(date +%y%m%d%H%M%S)";do
|
2024-02-25 19:51:06 +00:00
|
|
|
docker tag "`cat iid.txt`" "$DOCKER_REGISTRY/$GITHUB_REPOSITORY:$TAG"
|
|
|
|
docker push "$DOCKER_REGISTRY/$GITHUB_REPOSITORY:$TAG"
|
|
|
|
done
|
|
|
|
|