Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
zxcev committed Aug 19, 2024
1 parent 175450e commit e7c0d3b
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 23 deletions.
39 changes: 38 additions & 1 deletion .github/workflows/actions/containerization/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@
name: Containerize
description: build container image

inputs:
env:
required: true
dockerhub-username:
required: true
dockerhub-token:
required: true
artifact-name:
required: true
artifact-build-path:
required: true

runs:
using: composite
steps:

- uses: actions/checkout@v4
- name: download artifact
uses: actions/download-artifact@v4
with:
name: "${{ inputs.artifact-name }}"
path: ${{ inputs.artifact-build-path }}

- name: log in to dockerhub
uses: docker/login-action@v2
with:
username: ${{ inputs.dockerhub-username }}
password: ${{ inputs.dockerhub-token }}
- name: set docker image name with tag
run: |
ARTIFACT_WITH_TAG=$(echo ${{ inputs.artifact-name }} | sed 's/-/:/' )
ARTIFACT_WITH_TAG=${ARTIFACT_WITH_TAG%.*}
echo "CONTAINER_IMAGE_PATH=${{ inputs.dockerhub-username }}/$ARTIFACT_WITH_TAG" >> $GITHUB_ENV
echo "docker image name:tag will be `$CONTAINER_IMAGE_PATH`"
- name: push docker container image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.CONTAINER_IMAGE_PATH }}
53 changes: 31 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,30 +127,39 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: download artifact
uses: actions/download-artifact@v4
- name: containerization
uses: ./.github/workflows/actions/containerization
with:
name: "${{ needs.cfg.outputs.artifact-name }}"
path: ${{ env.ARTIFACT_BUILD_PATH }}

- name: log in to dockerhub
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: set docker image name with tag
run: |
ARTIFACT_WITH_TAG=$(echo ${{ needs.cfg.outputs.artifact-name }} | sed 's/-/:/' )
ARTIFACT_WITH_TAG=${ARTIFACT_WITH_TAG%.*}
echo "CONTAINER_IMAGE_PATH=${{ vars.DOCKERHUB_USERNAME }}/$ARTIFACT_WITH_TAG" >> $GITHUB_ENV
echo "docker image name:tag will be `$CONTAINER_IMAGE_PATH`"
env: ${{ env.ENV }}
dockerhub-username: ${{ vars.DOCKERHUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
artifact-name: ${{ needs.cfg.outputs.artifact-name }}
artifact-build-path: ${{ env.ARTIFACT_BUILD_PATH }}

- name: push docker container image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.CONTAINER_IMAGE_PATH }}
# - name: download artifact
# uses: actions/download-artifact@v4
# with:
# name: "${{ needs.cfg.outputs.artifact-name }}"
# path: ${{ env.ARTIFACT_BUILD_PATH }}

# - name: log in to dockerhub
# uses: docker/login-action@v2
# with:
# username: ${{ vars.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: set docker image name with tag
# run: |
# ARTIFACT_WITH_TAG=$(echo ${{ needs.cfg.outputs.artifact-name }} | sed 's/-/:/' )
# ARTIFACT_WITH_TAG=${ARTIFACT_WITH_TAG%.*}
# echo "CONTAINER_IMAGE_PATH=${{ vars.DOCKERHUB_USERNAME }}/$ARTIFACT_WITH_TAG" >> $GITHUB_ENV
# echo "docker image name:tag will be `$CONTAINER_IMAGE_PATH`"

# - name: push docker container image
# uses: docker/build-push-action@v4
# with:
# context: .
# push: true
# tags: ${{ env.CONTAINER_IMAGE_PATH }}

trigger-destroy-test-infra:
needs: [cfg, unit-test, integration-test, e2e-test]
Expand Down

0 comments on commit e7c0d3b

Please sign in to comment.