Skip to content

Commit

Permalink
output tag name
Browse files Browse the repository at this point in the history
  • Loading branch information
benlee0423 committed Nov 4, 2024
1 parent a031d96 commit f22042e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
7 changes: 6 additions & 1 deletion .github/action_templates/build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ runs:
run: |
echo "TAG_NAME=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
if: ${{ !startsWith(github.ref, 'refs/heads/main') }}

- name: Set outputs
id: set-outputs
shell: bash
run: |
echo "tag-name=${TAG_NAME}" >> $GITHUB_OUTPUT
- name: Attach platform to tag
shell: bash
run: |
echo "RAW_TAG=${{env.TAG_NAME}}" >> "$GITHUB_ENV"
echo "TAG_NAME=${{env.TAG_NAME}}-${{inputs.platform}}" >> "$GITHUB_ENV"
#if: "${{ inputs.platform != 'ARM64' }}"

Expand Down
8 changes: 7 additions & 1 deletion .github/action_templates/build-and-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ runs:
run: |
echo "TAG_NAME=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
if: ${{ !startsWith(github.ref, 'refs/heads/main') }}

- name: Set outputs
id: set-outputs
shell: bash
run: |
echo "tag-name=${TAG_NAME}" >> $GITHUB_OUTPUT
- name: Attach platform to tag
shell: bash
run: |
echo "RAW_TAG=${{env.TAG_NAME}}" >> "$GITHUB_ENV"
echo "TAG_NAME=${{env.TAG_NAME}}-${{inputs.platform}}" >> "$GITHUB_ENV"
#if: "${{ inputs.platform != 'ARM64' }}"

Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/docker_image_main_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ jobs:
build:
needs: init
runs-on: ${{ matrix.runner}}
outputs: # Define job outputs
test-tag-name: ${{ steps.test-build.outputs.tag-name }}
push-tag-name: ${{ steps.push-build.outputs.tag-name }}
strategy:
matrix:
runner: [arm64, x86]
steps:
- name: deploy
uses: actions/checkout@v2
- name: Build and test Docker image
id: test-build
uses: ./.github/action_templates/build-and-test
with:
docker-auth-token: ${{ secrets.DOCKER_AUTH_TOKEN }}
Expand All @@ -62,6 +66,7 @@ jobs:
platform: ${{ matrix.runner}}
if: ${{ !startsWith(github.ref, 'refs/heads/main') }}
- name: Build and push Docker image
id: push-build
uses: ./.github/action_templates/build-and-push
with:
docker-auth-token: ${{ secrets.DOCKER_AUTH_TOKEN }}
Expand Down Expand Up @@ -101,10 +106,15 @@ jobs:
env
- name: Create and push manifest
run: |
docker manifest create awiciroh/ciroh-ngen-image:${{ env.RAW_TAG}} \
awiciroh/ciroh-ngen-image:${{ env.RAW_TAG}}-arm64 \
awiciroh/ciroh-ngen-image:${{ env.RAW_TAG}}-x86
docker manifest push awiciroh/ciroh-ngen-image:latest
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
TAG_NAME="${{ needs.build.outputs.push-tag-name }}"
else
TAG_NAME="${{ needs.build.outputs.test-tag-name }}"
fi
docker manifest create awiciroh/ciroh-ngen-image:${TAG_NAME} \
awiciroh/ciroh-ngen-image:${TAG_NAME}-arm64 \
awiciroh/ciroh-ngen-image:${TAG_NAME}-x86
docker manifest push awiciroh/ciroh-ngen-image:${TAG_NAME}
slack:
runs-on: ARM64
Expand Down

0 comments on commit f22042e

Please sign in to comment.