Skip to content

Commit

Permalink
Publish settings workflow test (#29)
Browse files Browse the repository at this point in the history
* Publish settings workflow test

* Move env vars

* Check if workflow_dispatch

* Use fromJson

---------

Co-authored-by: Jay Qi <[email protected]>
  • Loading branch information
jayqi and jayqi authored Nov 26, 2023
1 parent d78c1f8 commit 77c69ce
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/publish-settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: build

on:
push:
branches: [main]
pull_request:
workflow_dispatch:
inputs:
publishDev:
description: 'Whether to publish image as cpu-{sha} and gpu-{sha}'
required: true
default: false
type: boolean

jobs:
build:
name: Build, Test, and Publish Image
runs-on: ubuntu-latest
strategy:
matrix:
proc: ["cpu", "gpu"]
env:
SHOULD_PUBLISH_LATEST: ${{ github.ref == 'refs/heads/main' && vars.PUBLISH_LATEST_ON_MAIN != '' }}
SHOULD_PUBLISH: |
${{
github.ref == 'refs/heads/main' && vars.PUBLISH_LATEST_ON_MAIN != ''
|| github.event_name == 'workflow_dispatch' && inputs.publishDev
}}
SHA_TAG: ${{ matrix.proc }}-${{ github.sha }}
LATEST_TAG: ${{ matrix.proc }}-latest

steps:

- name: Check SHOULD_PUBLISH
if: ${{ fromJson(env.SHOULD_PUBLISH) }}
run: |
echo "hit"
- name: Check SHOULD_PUBLISH_LATEST
if: ${{ fromJson(env.SHOULD_PUBLISH_LATEST) }}
run: |
echo "hit"

0 comments on commit 77c69ce

Please sign in to comment.