Skip to content

Commit

Permalink
ci: add workflow_dispatch and update docker tags
Browse files Browse the repository at this point in the history
  • Loading branch information
RanbirAulakh committed Oct 3, 2024
1 parent 66749f0 commit 620d368
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 55 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ jobs:
tox:
uses: ./.github/workflows/tox.yml
secrets: inherit
docker-build:
uses: ./.github/workflows/docker-build.yml
docker:
uses: ./.github/workflows/docker.yml
secrets: inherit
14 changes: 0 additions & 14 deletions .github/workflows/docker-build.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/docker-publish.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: docker build & publish

on:
workflow_call:
workflow_dispatch:
push:
branches: ["main"]

env:
REGISTRY: awsosml
IMAGE_NAME: ${{ github.event.repository.name }}

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: 'true'
- name: Set Docker Push Flag
run: |
[[ "${{ github.event_name }}" =~ ^(push|release|workflow_dispatch|workflow_call)$ ]] && echo "push=true" >> $GITHUB_ENV || echo "push=false" >> $GITHUB_ENV
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
type=semver,pattern={{raw}},enable=${{ github.event_name == 'release' }}
type=raw,value=nightly-dev,enable=${{ github.ref == 'refs/heads/main' && github.event_name == 'push' || github.event_name == 'workflow_dispatch'}}
type=raw,value={{date 'YYYYMMDD-hhmmss' tz='UTC'}},enable=${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
- uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: ${{ env.push }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: docs

on:
workflow_dispatch:
workflow_call:

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: notify

on:
workflow_dispatch:
push:
branches: ["main"]

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
name: pypi

on:
workflow_dispatch:
workflow_call:

permissions:
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
name: release

on:
workflow_dispatch:
release:
types: [published]

jobs:
tox:
uses: ./.github/workflows/tox.yml
secrets: inherit
docker-build:
uses: ./.github/workflows/docker-build.yml
secrets: inherit
pypi:
needs: [tox, docker-build]
needs: [tox]
uses: ./.github/workflows/pypi.yml
secrets: inherit
docker-publish:
needs: [tox, docker-build]
uses: ./.github/workflows/docker-publish.yml
docker:
needs: [tox]
uses: ./.github/workflows/docker.yml
secrets: inherit
docs:
needs: [pypi, docker-publish]
needs: [pypi, docker]
uses: ./.github/workflows/docs.yml
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
name: tox

on:
workflow_dispatch:
workflow_call:

permissions:
Expand Down

0 comments on commit 620d368

Please sign in to comment.