Fix deletion while iterating, deduplicate messages by ID, add reply c… #28
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: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| tag-commit: | |
| name: Tag commit with the new version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.tag.outputs.version }} | |
| env: | |
| VERSION_PATH: arabot/__init__.py | |
| VERSION_REGEX: '^\+__version__ = "(.+)"$' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout commit | |
| uses: actions/checkout@v5 | |
| with: | |
| sparse-checkout: ${{ env.VERSION_PATH }} | |
| sparse-checkout-cone-mode: false | |
| fetch-depth: 0 | |
| - name: Set credentials | |
| run: | | |
| git config user.name github-actions | |
| git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
| - name: Tag commit | |
| id: tag | |
| run: | | |
| VERSION=$(git diff ${{ github.event.before }} HEAD "$VERSION_PATH" | sed -nr "s/$VERSION_REGEX/\1/p") | |
| [ "$VERSION" ] && git tag -m "v$VERSION" "$VERSION" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Push tag | |
| if: steps.tag.outputs.version | |
| run: git push --tags | |
| build-and-push-image: | |
| name: Build, tag and push Docker image to Docker Hub and GHCR | |
| needs: tag-commit | |
| if: needs.tag-commit.outputs.version | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Build and push Docker images | |
| uses: docker/build-push-action@v6 | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| dockerhub_repository: ${{ vars.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} | |
| version: ${{ needs.tag-commit.outputs.version }} | |
| with: | |
| context: . | |
| secret-envs: database-url=DATABASE_URL | |
| push: true | |
| provenance: mode=max | |
| sbom: true | |
| tags: | | |
| ${{ env.dockerhub_repository }}:latest | |
| ${{ env.dockerhub_repository }}:${{ env.version }} | |
| ghcr.io/${{ github.repository }}:latest | |
| ghcr.io/${{ github.repository }}:${{ env.version }} | |
| annotations: | | |
| org.opencontainers.image.title=AraBot | |
| org.opencontainers.image.authors=${{ github.event.repository.owner.html_url }} | |
| org.opencontainers.image.version=${{ env.version }} | |
| org.opencontainers.image.source=${{ github.repositoryUrl }} | |
| org.opencontainers.image.url=https://hub.docker.com/repository/docker/${{ env.dockerhub_repository }}/tags/${{ env.version }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |