Skip to content

Commit

Permalink
Refactor TAG file check in build-mysql-container.yaml
Browse files Browse the repository at this point in the history
Signed-off-by: d-kuro <kurosawa7620@gmail.com>
  • Loading branch information
d-kuro committed Aug 2, 2023
1 parent 94e671f commit 7041575
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions .github/workflows/build-mysql-container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,21 @@ jobs:
with:
driver: docker # refs: https://github.com/docker/build-push-action/issues/321

- name: Check TAG file
- name: Export TAG file
id: tag
working-directory: containers
run: |
result="$(./tag_exists moco/mysql mysql/${{ matrix.mysql-version }})"
if [ "$result" = ok ]; then
exit 1
fi
echo "TAG=$(cat ./mysql/${{ matrix.mysql-version }}/TAG)" >> $GITHUB_ENV
TAG=$(cat ./mysql/${{ matrix.mysql-version }}/TAG)
echo "tag: $TAG"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- uses: docker/build-push-action@v4
with:
context: containers/mysql/${{ matrix.mysql-version }}/.
push: false
load: true
tags: |
ghcr.io/cybozu-go/moco/mysql:${{ env.TAG }}
ghcr.io/cybozu-go/moco/mysql:${{ steps.tag.outputs.tag }}
ghcr.io/cybozu-go/moco/mysql:${{ matrix.mysql-version }}
- name: Install Container Structure Tests
Expand Down Expand Up @@ -109,7 +108,7 @@ jobs:
- uses: actions/upload-artifact@v3
if: always()
with:
name: logs-${{ inputs.k8s-version }}-${{ inputs.mysql-version }}.tar.gz
name: logs-${{ matrix.k8s-version }}-${{ matrix.mysql-version }}.tar.gz
path: e2e/logs.tar.gz

build:
Expand All @@ -130,14 +129,13 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Check TAG file
- name: Export TAG file
id: tag
working-directory: containers
run: |
result="$(./tag_exists moco/mysql mysql/${{ matrix.mysql-version }})"
if [ "$result" = ok ]; then
exit 1
fi
echo "TAG=$(cat ./mysql/${{ matrix.mysql-version }}/TAG)" >> $GITHUB_ENV
TAG=$(cat ./mysql/${{ matrix.mysql-version }}/TAG)
echo "tag: $TAG"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- uses: docker/build-push-action@v4
with:
Expand All @@ -147,5 +145,5 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
ghcr.io/cybozu-go/moco/mysql:${{ env.TAG }}
ghcr.io/cybozu-go/moco/mysql:${{ steps.tag.outputs.tag }}
ghcr.io/cybozu-go/moco/mysql:${{ matrix.mysql-version }}

0 comments on commit 7041575

Please sign in to comment.