From c280eb9bd3ee78bebd4b36ea052faa05757f08d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Kr=C4=8Dek?= Date: Mon, 22 Jul 2024 14:17:46 +0200 Subject: [PATCH] Actions --- .gitea/workflows/release.yml | 60 ++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..7c18225 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,60 @@ +name: Build Docker image +run-name: ${{ gitea.actor }} is running the CI pipeline +on: + push: + branches: + - main + schedule: + - cron: "0 22 * * 0" # sunday 22:00 + +jobs: + test: + if: ${{ github.event_name }} != 'schedule' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: https://github.com/actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Setup tox + run: pip install tox>=4.16 + + - name: Run tox + run: tox + + build: + runs-on: ubuntu-latest + needs: test + steps: + - name: Get date for image label + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + + - name: Checkout code + uses: https://github.com/actions/checkout@v4 + + - name: Set up Docker Buildx + uses: https://github.com/docker/setup-buildx-action@v3 + with: + driver: docker-container + + - name: Login to Docker Registry + uses: https://github.com/docker/login-action@v3 + with: + registry: git.orebolt.cz + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build and push image + uses: https://github.com/docker/build-push-action@v5 + with: + context: . + push: true + tags: "${{ vars.DOCKER_IMAGE }}:latest,${{ vars.DOCKER_IMAGE }}:${{ steps.date.outputs.date }}" + platforms: linux/amd64,linux/arm/v7 + cache-to: "mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=${{ vars.DOCKER_IMAGE }}:cache" + cache-from: "mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=${{ vars.DOCKER_IMAGE }}:cache"