forked from Hithomelabs/CFTunnels
58 lines
2.4 KiB
YAML
58 lines
2.4 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: Validate Gradle Wrapper
|
|
uses: gradle/actions/wrapper-validation@v3
|
|
- name: Get latest tag
|
|
id: get_tag
|
|
run: |
|
|
VERSION=$(git describe --tags --abbrev=0)
|
|
echo "VERSION=${VERSION}" >> $GITEA_OUTPUT
|
|
MAJOR=$(echo ${VERSION} | cut -d "." -f 1)
|
|
echo "MAJOR=${MAJOR}" >> $GITEA_OUTPUT
|
|
MINOR=$(echo ${VERSION} | cut -d "." -f 2)
|
|
echo "MINOR=${MINOR}" >> $GITEA_OUTPUT
|
|
PATCH=$(echo ${VERSION} | cut -d "." -f 3)
|
|
echo "PATCH=${PATCH}" >> $GITEA_OUTPUT
|
|
- name: Increment version
|
|
id: calc_new_tag
|
|
run: |
|
|
echo "${{ steps.get_id.outputs.PATCH }}"
|
|
echo "NEW_PATCH=$(( ${{ steps.get_id.outputs.PATCH }} + 1))" >> $GITEA_OUTPUT
|
|
echo "NEW_VERSION=$( ${{ steps.get_id.outputs.MAJOR }}.${{ steps.get_id.outputs.MINOR }}.${NEW_PATCH})" >> $GITEA_OUTPUT
|
|
- name: Create and push tag
|
|
run: |
|
|
git tag -a ${{ steps.calc_new_tag.outputs.NEW_VERSION }} -m "Pushing new version ${{ steps.calc_new_tag.outputs.NEW_VERSION }}"
|
|
git push origin ${{ steps.calc_new_tag.outputs.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:${{ steps.calc_new_tag.outputs.NEW_VERSION }}
|
|
- name: Tag image as test
|
|
run: docker tag 192.168.0.100:8928/hithomelabs/cftunnels:${{ steps.calc_new_tag.outputs.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:${{ steps.calc_new_tag.outputs.NEW_VERSION }}
|