86 lines
3.0 KiB
YAML
86 lines
3.0 KiB
YAML
name: Build and Push
|
|
on:
|
|
push:
|
|
#branches:
|
|
# - main
|
|
# - 'feature/**'
|
|
|
|
jobs:
|
|
maintence:
|
|
runs-on: srvdnd
|
|
outputs:
|
|
date: ${{ steps.date.outputs.date }}
|
|
steps:
|
|
- name: Get current date
|
|
id: date
|
|
run: echo "date=$(TZ=":Asia/Yakutsk" date +'%FT%H-%M-%SR')" >> $GITHUB_OUTPUT
|
|
|
|
buildApp:
|
|
needs: [maintence]
|
|
runs-on: srvdnd
|
|
env:
|
|
TAG_NAME: ${{ needs.maintence.outputs.date }}${{ gitea.RUN_ID }}
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: https://git.tlgrf.ru/actions/checkout@v4
|
|
- name: Create docker image!
|
|
run: docker build -t git.tlgrf.local/${{ gitea.REPOSITORY }}/${{ gitea.REF_NAME }}:$TAG_NAME -t git.tlgrf.ru/${{ gitea.REPOSITORY }}/${{ gitea.REF_NAME }}:$TAG_NAME -t git.tlgrf.ru/${{ gitea.REPOSITORY }}/${{ gitea.REF_NAME }}:latest ./zont-exporter -f ./zont-exporter/Dockerfile
|
|
|
|
pushApp:
|
|
needs: [buildApp, maintence]
|
|
runs-on: srvdnd
|
|
env:
|
|
TAG_NAME: ${{ needs.maintence.outputs.date }}${{ gitea.RUN_ID }}
|
|
steps:
|
|
- name: Login to git.tlgrf.ru
|
|
uses: https://git.tlgrf.ru/actions/docker-login-action@v3
|
|
with:
|
|
registry: git.tlgrf.ru
|
|
username: gitea
|
|
password: ${{ secrets.GITEAPASSWORD }}
|
|
- name: Push docker image!
|
|
run: docker push git.tlgrf.ru/${{ gitea.REPOSITORY }}/${{ gitea.REF_NAME }}:$TAG_NAME && docker push git.tlgrf.ru/${{ gitea.REPOSITORY }}/${{ gitea.REF_NAME }}:latest
|
|
|
|
- name: Push notification
|
|
uses: https://git.tlgrf.ru/actions/rocketchat-notification-action@v3.0.0
|
|
with:
|
|
server: https://rc.tlgrf.ru
|
|
auth-token: ${{ secrets.ROCKETCHAT_AUTH_TOKEN }}
|
|
user-id: ${{ secrets.ROCKETCHAT_USER_ID }}
|
|
channel: python_rocketchat_api
|
|
message: |
|
|
Gitea | TLGRF
|
|
|
|
Repository: ${{ gitea.REPOSITORY }}
|
|
*${{ gitea.ACTOR }}* pushed to *${{ gitea.REF_NAME }}*
|
|
|
|
Commit message: ${{ gitea.event.commits[0].message }}
|
|
See changes: https://git.tlgrf.ru/${{ gitea.REPOSITORY }}/commit/${{gitea.SHA}}
|
|
```
|
|
docker pull git.tlgrf.ru/${{ gitea.REPOSITORY }}/${{ gitea.REF_NAME }}:${{ env.TAG_NAME }}
|
|
```
|
|
```
|
|
${{ env.TAG_NAME }}
|
|
```
|
|
|
|
#- name: send telegram message on push
|
|
# uses: appleboy/telegram-action@master
|
|
# with:
|
|
# to: -4251930066
|
|
# token: ${{ secrets.TELEGRAM_TOKEN_MIKUPTIME }}
|
|
# format: markdown
|
|
# message: |
|
|
# Gitea | TLGRF
|
|
#
|
|
# Repository: ${{ gitea.REPOSITORY }}
|
|
# *${{ gitea.ACTOR }}* pushed to *${{ gitea.REF_NAME }}*
|
|
#
|
|
# Commit message: ${{ gitea.event.commits[0].message }}
|
|
# See changes: https://git.tlgrf.ru/${{ gitea.REPOSITORY }}/commit/${{gitea.SHA}}
|
|
# ```
|
|
# docker pull git.tlgrf.ru/${{ gitea.REPOSITORY }}/${{ gitea.REF_NAME }}:${{ env.TAG_NAME }}
|
|
# ```
|
|
# ```
|
|
# ${{ env.TAG_NAME }}
|
|
# ```
|
|
|