Skip to content

Commit

Permalink
chore: add docker build in workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Shurtu-gal committed Jan 11, 2024
1 parent 180ced3 commit 85b5ec8
Showing 1 changed file with 111 additions and 0 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,50 @@ jobs:
outputs:
shouldrun: ${{ steps.should_run.outputs.shouldrun }}

build-docker:
needs: should-workflow-run
name: Build Docker image
if: ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get docker version
id: docker_version
run: >
action=$(cat action.yml); \
regex='docker:\/\/asyncapi\/github-action-for-cli:([0-9.]+)'; \
[[ $action =~ $regex ]]; \
action_version=${BASH_REMATCH[1]}; \
echo "action_version=$action_version" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image and export
uses: docker/build-push-action@v5
with:
context: .
tags: asyncapi/github-action-for-cli:${{ steps.docker_version.outputs.action_version }}
outputs: type=docker,dest=/tmp/asyncapi.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: myimage
path: /tmp/asyncapi.tar


test-defaults:
if: ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }}
runs-on: ubuntu-latest
needs: should-workflow-run
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: asyncapi
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/asyncapi.tar
docker image ls -a
- uses: actions/checkout@v4
- name: Test GitHub Action
uses: ./
Expand All @@ -56,6 +95,15 @@ jobs:
runs-on: ubuntu-latest
needs: should-workflow-run
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: asyncapi
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/asyncapi.tar
docker image ls -a
- uses: actions/checkout@v4
- name: Test GitHub Action
uses: ./
Expand All @@ -68,6 +116,15 @@ jobs:
runs-on: ubuntu-latest
needs: should-workflow-run
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: asyncapi
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/asyncapi.tar
docker image ls -a
- uses: actions/checkout@v4
- name: Test GitHub Action
uses: ./
Expand All @@ -93,6 +150,15 @@ jobs:
runs-on: ubuntu-latest
needs: should-workflow-run
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: asyncapi
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/asyncapi.tar
docker image ls -a
- uses: actions/checkout@v4
- name: Test GitHub Action
uses: ./
Expand All @@ -117,6 +183,15 @@ jobs:
runs-on: ubuntu-latest
needs: should-workflow-run
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: asyncapi
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/asyncapi.tar
docker image ls -a
- uses: actions/checkout@v4
- name: Test GitHub Action
id: test
Expand All @@ -138,6 +213,15 @@ jobs:
runs-on: ubuntu-latest
needs: should-workflow-run
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: asyncapi
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/asyncapi.tar
docker image ls -a
- uses: actions/checkout@v4
- name: Test GitHub Action
id: test
Expand All @@ -161,6 +245,15 @@ jobs:
runs-on: ubuntu-latest
needs: should-workflow-run
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: asyncapi
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/asyncapi.tar
docker image ls -a
- uses: actions/checkout@v4
- name: Test GitHub Action
uses: ./
Expand All @@ -186,6 +279,15 @@ jobs:
runs-on: ubuntu-latest
needs: should-workflow-run
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: asyncapi
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/asyncapi.tar
docker image ls -a
- uses: actions/checkout@v4
- name: Make output directory
run: mkdir -p ./output/bundle
Expand All @@ -211,6 +313,15 @@ jobs:
runs-on: ubuntu-latest
needs: should-workflow-run
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: asyncapi
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/asyncapi.tar
docker image ls -a
- uses: actions/checkout@v4
- name: Test GitHub Action
uses: ./
Expand Down

0 comments on commit 85b5ec8

Please sign in to comment.