Add support for cloudflare_worker_operation_count (#17) #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Publish Docker Images after push to master branch | |
| on: | |
| push: | |
| branches: [master] | |
| jobs: | |
| build-and-push-docker-image: | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| name: Build Docker image and push to repositories with tag latest | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Login to Github Packages | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: false | |
| - uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9 | |
| with: | |
| version: v0.18.0 | |
| - name: Build and push | |
| id: publish-image | |
| env: | |
| KO_DOCKER_REPO: "ghcr.io/${{ github.repository }}" | |
| run: | | |
| ko build . --sbom=none --bare --platform linux/arm64,linux/amd64 -t latest \ | |
| --image-label org.opencontainers.image.title=cloudflare-exporter \ | |
| --image-label org.opencontainers.image.description="Prometheus CloudFlare Exporter" \ | |
| --image-label org.opencontainers.image.url=${{ github.server_url }}/${{ github.repository }} \ | |
| --image-label org.opencontainers.image.revision=${{ github.sha }} \ | |
| --image-label org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} \ | |
| --image-label org.opencontainers.image.licenses=Apache-2.0 \ | |
| --image-label org.opencontainers.image.version=latest \ | |
| --image-label org.opencontainers.image.created="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | |
| distribute-to-dockerhub: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build-and-push-docker-image | |
| permissions: | |
| packages: read | |
| steps: | |
| - name: Copy image to dockerhub | |
| env: | |
| GHCR_REPO: "ghcr.io/${{ github.repository }}" | |
| GHCR_USERNAME: ${{ github.actor }} | |
| GHCR_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
| DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
| DOCKER_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
| run: | | |
| docker run --rm quay.io/containers/skopeo:v1.18.0 \ | |
| copy --multi-arch all \ | |
| --src-creds "$GHCR_USERNAME:$GHCR_PASSWORD" \ | |
| --dest-creds "$DOCKER_USERNAME:$DOCKER_TOKEN" \ | |
| docker://${GHCR_REPO}:latest \ | |
| docker://lablabs/cloudflare_exporter:latest |