ci #448
This file contains 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 | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: '0 0 * * *' # Runs every day at 00:00 UTC | |
jobs: | |
build_push: | |
name: Build and Push | |
strategy: | |
matrix: | |
service: [tesseract-lambda-python,keyword-lambda-python,tesseract-web,tesseract-lambda] | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: docker_meta | |
uses: docker/[email protected] | |
with: | |
images: ashirt/${{ matrix.service }} # list of Docker images to use as base name for tags | |
tags: | | |
type=sha | |
type=ref,event=branch | |
type=ref,event=pr | |
flavor: | | |
latest=false | |
- name: Login to Docker Hub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/[email protected] | |
- name: Build and Push PR | |
if: github.ref != 'refs/heads/main' | |
uses: docker/[email protected] | |
with: | |
context: workers/${{ matrix.service }} | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
push: true # Push with pr-### and sha-xxxxxxx tags | |
- name: Build and Push Latest | |
if: github.ref == 'refs/heads/main' | |
uses: docker/[email protected] | |
with: | |
context: workers/${{ matrix.service }} | |
tags: ${{ steps.docker_meta.outputs.tags }}, ashirt/${{ matrix.service }}:latest #Add latest tag for main | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
push: true |