Skip to content

Commit

Permalink
2024-06-14 19:22 - updates
Browse files Browse the repository at this point in the history
  • Loading branch information
saxix committed Jun 14, 2024
1 parent 5cb701e commit 3d9d028
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
14 changes: 1 addition & 13 deletions .github/actions/docker_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ runs:
- name: Output Inputs
shell: bash
run: |
echo "====================================="
echo ""
echo "${{ toJSON(inputs) }}"
echo "====================================="
# - run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
Expand Down Expand Up @@ -100,18 +100,6 @@ runs:
- name: Retrieve Last Commit Hash
id: last_commit
uses: ./.github/actions/last_commit

# - name: Setup Environment (PR)
# if: ${{ github.event_name == 'pull_request' }}
# shell: bash
# run: |
# SHA=${{ github.event.pull_request.head.sha }}
# echo "LAST_COMMIT_SHA=${SHA::7}" >> ${GITHUB_ENV}
# - name: Setup Environment (Push)
# if: ${{ github.event_name == 'push' }}
# shell: bash
# run: |
# echo "LAST_COMMIT_SHA=${GITHUB_SHA::7}" >> ${GITHUB_ENV}
- shell: bash
run: |
echo ""
Expand Down
24 changes: 17 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jobs:
branch: ${{ steps.extract_branch.outputs.branch }}
hash: ${{ steps.release_hash.outputs.hash }}
tags: ${{ steps.meta.outputs.tags }}
version: ${{ steps.meta.outputs.version }}
tag: ${{ steps.meta.outputs.version }}
version: ${{ steps.version.outputs.version }}
image_name: ${{ steps.image_name.outputs.name }}
steps:
# - run: git config --global --add safe.directory $(realpath .)
Expand All @@ -59,13 +60,14 @@ jobs:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
- name: set outputs
- id: version
run: |
echo "${{ toJSON(steps.meta.outputs) }}"
echo "version=${{steps.meta.outputs.version}}" >> $GITHUB_OUTPUT
br=${{ steps.extract_branch.outputs.branch }}
echo "version=${br##*/}" >> $GITHUB_OUTPUT
build:
# if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: Build Test Docker Image
needs: [setup]
runs-on: ubuntu-latest
defaults:
Expand All @@ -74,14 +76,17 @@ jobs:
outputs:
image: ${{ steps.image_name.outputs.name }}
steps:
- run: |
echo ""
echo ${{ toJSON(needs.setup.outputs) }}
- name: Checkout code
uses: actions/checkout@v2
- name: Define target image name
id: image_name
run: |
echo "name=${{vars.DOCKER_IMAGE}}:test-${{needs.setup.outputs.version}}" >> $GITHUB_OUTPUT
echo "name=${{vars.DOCKER_IMAGE}}:test-${{needs.setup.outputs.tag}}" >> $GITHUB_OUTPUT
- id: doit

uses: ./.github/actions/docker_build
with:
image: ${{steps.image_name.outputs.name}}
Expand All @@ -93,6 +98,7 @@ jobs:

test:
# if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: Run Tests
needs: [build]
runs-on: ubuntu-latest
services:
Expand Down Expand Up @@ -135,8 +141,10 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: false
name: codecov-${{env.GITHUB_REF_NAME}}

release:
# if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: Release deployment image
needs: [setup, test]
runs-on: ubuntu-latest
defaults:
Expand All @@ -150,7 +158,7 @@ jobs:
- name: Define target image name
id: image_name
run: |
echo "name=${{vars.DOCKER_IMAGE}}:${{needs.setup.outputs.version}}" >> $GITHUB_OUTPUT
echo "name=${{vars.DOCKER_IMAGE}}:${{needs.setup.outputs.tag}}" >> $GITHUB_OUTPUT
- id: doit
uses: ./.github/actions/docker_build
with:
Expand All @@ -163,7 +171,9 @@ jobs:
- run: |
echo "::notice:: ${{steps.image_name.outputs.name}} pushed to dockerhub"
trivy:
name: Check Image with Trivy
runs-on: ubuntu-latest
needs: [release]
steps:
Expand Down

0 comments on commit 3d9d028

Please sign in to comment.