Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
davema-clan committed Apr 25, 2024
1 parent 3a6136c commit e83890c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/hello.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
contents: read
packages: write

outputs:
IMAGE_TAG: ${{ steps.get_short_sha.outputs.SHORT_SHA}}

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -27,24 +30,31 @@ jobs:
run: echo "${{ secrets.SECRETS_GITHUB_TOKEN }}" | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin

- name: Get Short SHA
id: get_short_sha
run: |
echo "SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_ENV
SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-7)"
echo "SHORT_SHA=$SHORT_SHA" >> $GITHUB_OUTPUT
echo "Short SHA: $SHORT_SHA"
- name: Build images
env:
IMAGE_TAG: ${{ steps.get_short_sha.outputs.SHORT_SHA}}
if: ${{ github.ref_type == 'branch' }}
run: make build ARGS="ghcr.io/${{ github.repository }}/" IMAGE_TAG="${{ env.SHORT_SHA }}" IMAGE_NAME=${{ env.IMAGE_NAME }}
run: make build ARGS="ghcr.io/${{ github.repository }}/" IMAGE_TAG="${IMAGE_TAG}" IMAGE_NAME=${{ env.IMAGE_NAME }}

- name: Push images to repository
env:
IMAGE_TAG: ${{ steps.get_short_sha.outputs.SHORT_SHA}}
if: ${{ github.ref_type == 'branch' }}
run: make push ARGS="ghcr.io/${{ github.repository }}/" IMAGE_TAG="${{ env.SHORT_SHA }}" IMAGE_NAME=${{ env.IMAGE_NAME }}
run: make push ARGS="ghcr.io/${{ github.repository }}/" IMAGE_TAG="${IMAGE_TAG}" IMAGE_NAME=${{ env.IMAGE_NAME }}

deploy_test:
runs-on: ubuntu-latest
needs: build

steps:
- name: Get Short SHA
id: get_short_sha
run: |
echo "SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_ENV
echo "Short SHA: $SHORT_SHA"
Expand All @@ -55,7 +65,7 @@ jobs:
GITHUB_ACTOR: $GITHUB_ACTOR
SECRETS_GITHUB_TOKEN: ${{ secrets.SECRETS_GITHUB_TOKEN }}
IMAGE_NAME: ${{ env.IMAGE_NAME }}
IMAGE_TAG: ${{ env.SHORT_SHA }}
IMAGE_TAG: ${{ needs.build.outputs.IMAGE_TAG}}
REGISTRY: ${{ github.repository }}
with:
host: ${{ secrets.REMOTE_HOST_TEST }}
Expand Down

0 comments on commit e83890c

Please sign in to comment.