CFTunnels/.gitea/workflows/test_image_build_push.yml
hitanshu310 c24abc76be
Some checks failed
sample gradle build and test / build (pull_request) Successful in 1m38s
sample gradle build and test / build (push) Failing after 10s
Trying to figure out RCA
2025-06-06 01:54:20 +05:30

55 lines
1.9 KiB
YAML

name: sample gradle build and test
run-name: Build started by $ {{gitea.actor}}
on:
push:
branches: [test]
jobs:
build:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: JDK setup
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Get latest tag
id: get_tag
run: |
export "VERSION=$(git describe --tags --abbrev=0)" >> $GITEA_ENV
echo "${VERSION}"
export "MAJOR=$(echo ${VERSION} | /usr/bin/cut -d "." -f 1)"
echo "MAJOR=${MAJOR}"
export "MINOR=$(echo ${VERSION} | cut -d "." -f 2)"
echo "MINOR=${MINOR}"
export "PATCH=$(echo ${VERSION} | cut -d "." -f 3)"
echo "PATCH=${PATCH}"
- name: Increment version
run: |
cat $GITEA_ENV
- name: Extract commit message
run: echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B)"
- name: Create and push tag
run: |
git tag -a ${NEW_VERSION} -m "${COMMIT_MESSAGE}"
git push origin ${NEW_VERSION}
- name: Log in to Gitea Docker Registry
uses: docker/login-action@v3
with:
registry: 'http://192.168.0.100:8928'
username: hitanshu
password: ${{ secrets.TOKEN }}
- name: Gradle build
run: ./gradlew bootBuildImage --imageName=192.168.0.100:8928/hithomelabs/cftunnels:${NEW_VERSION}
- name: Tag image as test
run: docker tag 192.168.0.100:8928/hithomelabs/cftunnels:${NEW_VERSION} 192.168.0.100:8928/hithomelabs/cftunnels:test
- name: Push to Gitea Registry
run: |
docker push 192.168.0.100:8928/hithomelabs/cftunnels:test
docker push 192.168.0.100:8928/hithomelabs/cftunnels:${NEW_VERSION}