[testing] docker workflows #10
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 Docker Container | ||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- 'main' | ||
schedule: | ||
- cron: '0 0 * * *' | ||
env: | ||
DEV: ${{ github.base_ref == "main"}} | ||
Check failure on line 14 in .github/workflows/build-container.yml GitHub Actions / Build Docker ContainerInvalid workflow file
|
||
NAME: ${{ github.event.number }} | ||
permissions: | ||
contents: read | ||
packages: write | ||
jobs: | ||
build-container: | ||
name: Build sparseml container | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
buildkitd-flags: --debug | ||
- name: debug | ||
run: | | ||
echo $DEV | ||
echo ${{github.head_ref}} | ||
echo ${{github.event_name}} | ||
echo ${{github.event.action}} | ||
echo ${{github.ref_name}} | ||
echo ${{ github.base_ref == "main"}} | ||
- 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=${{ github.ref_name }} | ||
- 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 }} |