Call python in entrypoint directly #34
Workflow file for this run
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: Build and push agents images | |
on: | |
push: {} | |
workflow_dispatch: {} | |
workflow_call: {} | |
jobs: | |
generate-matrix: | |
name: Generate build matrix | |
runs-on: ubuntu-22.04 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: diambra/agents | |
fetch-depth: 0 | |
- id: set-matrix | |
run: echo "::set-output name=matrix::$(./.github/workflows/generate-image-build-matrix basic/* *)" | |
checkout_and_download_lfs: | |
name: Checkout and Download LFS | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout selected branch | |
uses: actions/checkout@v3 | |
with: | |
repository: diambra/agents | |
lfs: true | |
- name: Store repo with LFS files as artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: repo-lfs-artifacts | |
path: . # You can specify the path to the LFS files if they are in a specific directory | |
build-and-push-images: | |
needs: [generate-matrix, checkout_and_download_lfs] | |
runs-on: ubuntu-latest | |
if: ${{ needs.generate-matrix.outputs.matrix != '[]' }} | |
strategy: | |
fail-fast: true | |
matrix: | |
include: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
steps: | |
- name: Restore repo with LFS files from artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: repo-lfs-artifacts | |
- name: Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
registry: docker.io | |
username: diambrabot | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to Quay | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: diambra+github | |
password: ${{ secrets.QUAY_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
ghcr.io/diambra/agent-${{ matrix.name }} | |
docker.io/diambra/agent-${{ matrix.name }} | |
quay.io/diambra/agent-${{ matrix.name }} | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Find base tag | |
id: base-tag | |
run: | | |
ref=${{ steps.meta.outputs.version }} | |
# on release-* branches, use branch as base tag | |
if [[ $ref == release-* ]]; then | |
echo "tag=$ref" >> "$GITHUB_OUTPUT" | |
exit 0 | |
fi | |
# on any other branch, use main as base tag | |
if [[ ! $ref =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then | |
echo "tag=main" >> "$GITHUB_OUTPUT" | |
exit 0 | |
fi | |
major=${ref%%.*} | |
minor_and_patch=${ref#*.} | |
minor=${minor_and_patch%%.*} | |
echo "tag=v${major}.${minor}" >> "$GITHUB_OUTPUT" | |
- name: Build and push agent ${{ matrix.dir }} | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ matrix.dir }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
TAG=${{ steps.base-tag.outputs.tag }} |