Skip to content

Commit

Permalink
Merge pull request #1258 from swirlai/ds1759-workflows-develop
Browse files Browse the repository at this point in the history
sequence docker and docker-sa on develop branch
  • Loading branch information
dnicodemus committed Feb 29, 2024
2 parents bc1590e + 08c061f commit ab71b46
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 7 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/docker-image-sa.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: SA DockerBuild

on:
# Allows manual run of this workflow from the Actions tab (on any branch)
workflow_run:
workflows: [Docker Build]
types:
- completed
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# For debugging
Expand All @@ -12,9 +16,35 @@ on:
jobs:

build:
if: (github.event_name == 'workflow_dispatch') || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
runs-on: ubuntu-latest

steps:
- name: Download Branch and run_id Artifacts
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: docker-image.yml
name: branch-info-${{ github.event_name == 'workflow_run' && github.event.workflow_run.id || github.run_id }}
path: ./artifacts
continue-on-error: true # Allow the step to fail without stopping the workflow
- name: Determine Branch for Checkout
id: determine_branch
run: |
if [[ -f ./artifacts/branch.txt && -f ./artifacts/run_id.txt ]]; then
echo "branch=$(cat ./artifacts/branch.txt)" >> $GITHUB_ENV
echo "original_run_id=$(cat ./artifacts/run_id.txt)" >> $GITHUB_ENV
else
BRANCH_NAME=$(echo $GITHUB_REF | cut -d "/" -f 3)
echo "branch=$BRANCH_NAME" >> $GITHUB_ENV
fi
- name: Print Branch to be Checked Out
run: |
echo "Branch to checkout: ${{ env.branch }}"
- name: Checkout the Code
uses: actions/checkout@v4
with:
ref: ${{ env.branch }}
- name: Checkout the code
uses: actions/checkout@v4
- name: Login to Docker Hub
Expand All @@ -38,7 +68,6 @@ jobs:
run: docker buildx create --name devBuilder --use --bootstrap
- name: Build the Docker Image
run: docker buildx build -f DevUtils/docker/Dockerfile.sa --platform linux/amd64,linux/arm64 --tag swirlai/swirl-search:develop-sa --push .

- name: Upload log files
if: always()
uses: actions/upload-artifact@v4
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: DockerBuild
name: Docker Build

on:
# Allows manual run of this workflow from the Actions tab (on any branch)
Expand All @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout the code
- name: Checkout the Code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -37,14 +37,32 @@ jobs:
- name: Builder Bootstrap
run: docker buildx create --name devBuilder --use --bootstrap
- name: Build the Docker Image
run: docker buildx build -t swirlai/swirl-search:develop --platform linux/amd64,linux/arm64 --push .
- name: Update repo description
run: docker buildx build -t swirlai/swirl-search:latest --platform linux/amd64,linux/arm64 --push .
- name: Update the Docker Repo Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_USERNAME_X }}
password: ${{ secrets.DOCKER_PASSWORD_X }}
repository: swirlai/swirl-search
- name: Upload log files
- name: Create Artifacts Directory
run: mkdir -p artifacts
- name: Set Branch Name
id: extract_branch
run: |
BRANCH_NAME=$(echo $GITHUB_REF | cut -d "/" -f 3)
echo "branch=$BRANCH_NAME" >> $GITHUB_ENV
- name: Write Branch and run_id to File
run: |
echo "${{ env.branch }}" > ./artifacts/branch.txt
echo "${{ github.run_id }}" > ./artifacts/run_id.txt
- name: Upload Branch and run_id Files as Artifacts
uses: actions/upload-artifact@v4
with:
name: branch-info-${{ github.run_id }}
path: |
./artifacts/branch.txt
./artifacts/run_id.txt
- name: Upload Log Files
if: always()
uses: actions/upload-artifact@v4
with:
Expand Down

0 comments on commit ab71b46

Please sign in to comment.