Skip to content

[testing] docker workflows #17

[testing] docker workflows

[testing] docker workflows #17

name: Build Docker Container
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
push:
branches:
- 'main'
schedule:
- cron: '0 0 * * *'
env:
DEV: ${{ github.base_ref == 'main' && github.event_name == 'pull_request'}}
NAME: ${{ github.event.number }}
permissions:
contents: read
packages: write
jobs:
build-container:
name: Build sparseml container
runs-on: ubuntu-latest
steps:
- name: Determine branch
run: |

Check failure on line 28 in .github/workflows/build-container.yml

View workflow run for this annotation

GitHub Actions / Build Docker Container

Invalid workflow file

The workflow is not valid. .github/workflows/build-container.yml (Line: 28, Col: 14): Unexpected symbol: '$DEV'. Located at position 1 within expression: $DEV = 'true'
if ${{ $DEV = 'true' }}; then
echo "BRANCH=${{github.ref_name}}" >> "$GITHUB_ENV"
else
echo "BRANCH=main" >> "$GITHUB_ENV"
fi
- name: Checkout code
uses: actions/checkout@v3
with:
ref: $BRANCH
fetch-depth: 1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: --debug
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')"
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Dev Docker Container
if: ${{ env.DEV == 'true' }}
uses: docker/build-push-action@v4
with:
context: ./docker_dev
build-args: |
BRANCH=$BRANCH
- name: Build Nightly Docker Container
if: ${{ env.DEV == 'false' }}
uses: docker/build-push-action@v4
with:
context: ./docker_nightly
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ghcr.io/neuralmagic/test-sparseml-nightly:latest, ghcr.io/neuralmagic/test-sparseml-nightly:${{ steps.date.outputs.date }}