feat: log when msg sent to slack #73
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 push docker image to registry | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - 'main' | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| paths: | |
| - ".github/workflows/build.yaml" | |
| - ".github/workflows/test.yaml" | |
| - "issue-bot/**" | |
| - "rust-toolchain.toml" | |
| - "Dockerfile" | |
| branches: | |
| - 'main' | |
| jobs: | |
| build-and-push-image: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: pgvector/pgvector:pg17 | |
| env: | |
| POSTGRES_USER: local | |
| POSTGRES_PASSWORD: supersecurepassword | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| permissions: | |
| contents: write | |
| packages: write | |
| # This is used to complete the identity challenge | |
| # with sigstore/fulcio when running outside of PRs. | |
| id-token: write | |
| security-events: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Initialize Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver-opts: | | |
| network=host | |
| - name: Inject slug/short variables | |
| uses: rlespinasse/github-slug-action@v4 | |
| - name: Run sccache-cache | |
| uses: mozilla-actions/[email protected] | |
| - name: Set sccache environment | |
| run: | | |
| echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | |
| echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | |
| - name: Login to GitHub Container Registry | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ghcr.io/huggingface/lor-e | |
| flavor: | | |
| latest=false | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=latest | |
| type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }} | |
| - name: Setup database | |
| env: | |
| PGPASSWORD: "supersecurepassword" | |
| run: | | |
| sudo apt-get update && sudo apt-get install libpq-dev -y | |
| psql -U local -a -f init_db.sql -h localhost | |
| - name: Build and push Docker image | |
| id: build-and-push | |
| uses: docker/build-push-action@v6 | |
| env: | |
| DOCKER_BUILD_SUMMARY: false | |
| with: | |
| context: . | |
| push: ${{ github.event_name != 'pull_request' }} | |
| platforms: 'linux/amd64' | |
| network: host | |
| build-args: | | |
| GIT_SHA=${{ env.GITHUB_SHA }} | |
| DOCKER_LABEL=sha-${{ env.GITHUB_SHA_SHORT }} | |
| DATABASE_URL=postgres://local:supersecurepassword@localhost:5432/lor_e | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |