name: Test, Build and Push on: push: branches: - main tags: - 'v[0-9]*' jobs: test-gateway: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.13' - name: Install run: pip install -e "./gateway[dev]" - name: Lint and test working-directory: gateway run: | ruff check src tests ruff format --check src tests pytest release: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') steps: - name: Create Gitea Release run: | curl -sf -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ -d '{"tag_name": "${{ github.ref_name }}", "name": "Release ${{ github.ref_name }}", "body": "Automated release for ${{ github.ref_name }}"}' \ "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" build-gateway: runs-on: ubuntu-latest needs: test-gateway if: startsWith(github.ref, 'refs/tags/') steps: - uses: actions/checkout@v4 - name: Login to Gitea Registry uses: docker/login-action@v3 with: registry: git.schweitz.internal username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_PASSWORD }} - name: Build and push uses: docker/build-push-action@v6 with: context: gateway push: true provenance: false sbom: false tags: | git.schweitz.internal/jpmschweitzer/desklock-gateway:latest git.schweitz.internal/jpmschweitzer/desklock-gateway:${{ github.ref_name }} - name: Trigger Watchtower update if: success() run: | curl -sf -H "Authorization: Bearer ${{ secrets.WATCHTOWER_HTTP_API_TOKEN }}" \ http://watchtower:8080/v1/update