Update build_and_publish.yaml #9
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 Publish Docker Images | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '*/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
app_dir: | |
- voluseg | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Builder | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# username: YOUR_GITHUB_USERNAME # Replace with your GitHub username | |
# password: ${{ secrets.GHCR_PAT }} # Use the PAT secret | |
- name: Pip install dendro | |
run: | | |
python -m pip install --upgrade pip | |
git clone https://github.com/magland/dendro.git | |
cd dendro/python | |
git pull | |
pip install . | |
- name: Generate Spec File | |
run: | | |
cd ${{ matrix.app_dir }} | |
chmod +x main.py | |
dendro make-app-spec-file --app-dir . --spec-output-file spec.json | |
- name: Build and push | |
run: | | |
cd ${{ matrix.app_dir }} | |
ls | |
pwd | |
docker build -t ghcr.io/catalystneuro/dendro-${{ matrix.app_dir }}:latest . | |
docker push ghcr.io/catalystneuro/dendro-${{ matrix.app_dir }}:latest | |
- name: Commit files | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
GIT_STATUS=$(git status -s) | |
[[ ! -z "$GIT_STATUS" ]] && git add ${{ matrix.app_dir }}/spec.json && git commit -m "update spec.json" -a || echo "No changes to commit" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |