Incrementing minor version and building an PROD image when PR merged to main
All checks were successful
sample gradle build and test / build (pull_request) Successful in 1m24s
sample gradle build and test / tag (push) Successful in 6s
sample gradle build and test / build_tag_push (push) Successful in 2m17s
Promote image with tag test to prod / tag (push) Successful in 7s
Promote image with tag test to prod / build_tag_push (push) Successful in 2m14s
All checks were successful
sample gradle build and test / build (pull_request) Successful in 1m24s
sample gradle build and test / tag (push) Successful in 6s
sample gradle build and test / build_tag_push (push) Successful in 2m17s
Promote image with tag test to prod / tag (push) Successful in 7s
Promote image with tag test to prod / build_tag_push (push) Successful in 2m14s
This commit is contained in:
parent
4016854514
commit
c8ba9ef6a9
64
.gitea/workflows/prod_image_build_push.yaml
Normal file
64
.gitea/workflows/prod_image_build_push.yaml
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
name: Promote image with tag test to prod
|
||||||
|
run-name: Build started by $ {{gitea.actor}}
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
jobs:
|
||||||
|
tag:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
new_version: ${{ steps.new_version.outputs.new_version }}
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Get new version
|
||||||
|
id: new_version
|
||||||
|
run: |
|
||||||
|
VERSION=$(git describe --tags --abbrev=0)
|
||||||
|
echo ${VERSION}
|
||||||
|
MAJOR=$(echo ${VERSION} | cut -d "." -f 1)
|
||||||
|
MINOR=$(echo ${VERSION} | cut -d "." -f 2)
|
||||||
|
PATCH=0
|
||||||
|
NEW_MINOR=$(( ${MINOR} + 1))
|
||||||
|
echo ${NEW_MINOR}
|
||||||
|
echo "new_version=$(echo "${MAJOR}.${NEW_MINOR}.${PATCH}")" >> $GITHUB_OUTPUT
|
||||||
|
build_tag_push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: tag
|
||||||
|
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: Create and push tag
|
||||||
|
run: |
|
||||||
|
echo "NEW_VERSION=${{ needs.tag.outputs.new_version }}"
|
||||||
|
git config --global user.name "${{gitea.actor}}"
|
||||||
|
git config --global user.email "${{ gitea.actor }}@users.noreply.github.com"
|
||||||
|
git tag -a ${{ needs.tag.outputs.new_version }} -m "Pushing new version ${{ needs.tag.outputs.new_version }}"
|
||||||
|
git push origin ${{ needs.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:${{ needs.tag.outputs.new_version }}
|
||||||
|
- name: Tag image as test
|
||||||
|
run: docker tag 192.168.0.100:8928/hithomelabs/cftunnels:${{ needs.tag.outputs.new_version }} 192.168.0.100:8928/hithomelabs/cftunnels:prod
|
||||||
|
- name: Push to Gitea Registry
|
||||||
|
run: |
|
||||||
|
docker push 192.168.0.100:8928/hithomelabs/cftunnels:prod
|
||||||
|
docker push 192.168.0.100:8928/hithomelabs/cftunnels:${{ needs.tag.outputs.new_version }}
|
||||||
Loading…
Reference in New Issue
Block a user