on: [push, pull_request, workflow_dispatch] name: Build jobs: build: name: Build runs-on: ubuntu-latest permissions: packages: write contents: write pull-requests: read checks: write env: DOCKER_REGISTRY: devops.lty.name DOCKER_IMAGE: ${{ github.repository }} steps: - uses: actions/checkout@v4 with: persist-credentials: false - uses: actions/setup-go@v5 with: go-version: '1.23' - uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 with: version: v1.63 - name: build run: | make build cp -r bin ${DISTNAME} cp -r agents ${DISTNAME} tar --zstd -cvf ${DISTNAME}.tar.zst ${DISTNAME} env: DISTNAME: chatai-linux-amd64-${{ github.ref_name }} - if: startsWith(github.ref, 'refs/tags/') uses: https://gitea.com/actions/release-action@21a5938ff2548f6472d89ba13b3cdd8af4c67068 with: api_key: ${{ secrets.GITHUB_TOKEN }} files: | *.tar.zst - uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 - uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 with: registry: ${{ env.DOCKER_REGISTRY }} username: ${{ github.repository_owner }} password: ${{ secrets.PACKAGES_PUBLISH_TOKEN }} - if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 with: context: . file: ./Dockerfile push: true tags: | ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ startsWith(github.ref, 'refs/tags/') && 'latest' || 'dev' }} ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || github.sha }}