ci: add missing escape #141
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| - push | |
| - pull_request | |
| concurrency: | |
| group: ${{ github.head_ref || github.sha }}-${{ github.workflow }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: ${{ matrix.id }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| id: | |
| - "mysql-8.0" | |
| - "mysql-8.4" | |
| steps: | |
| - name: Parse ID | |
| id: parse | |
| run: | | |
| set -x | |
| if [ "${GITHUB_REF_TYPE}" = "tag" ] && [[ "${GITHUB_REF_NAME}" =~ ^${{ matrix.id }}\. ]]; then | |
| version="${GITHUB_REF_NAME}" | |
| else | |
| version=${{ matrix.id }}-latest | |
| fi | |
| push=false | |
| if [ "${GITHUB_EVENT_NAME}" = "push" ]; then | |
| push=true | |
| if [ "${GITHUB_REF_TYPE}" = "tag" ] && [ "${version}" != "${GITHUB_REF_NAME}" ]; then | |
| push=false | |
| fi | |
| fi | |
| tag="groonga/mroonga:${version}" | |
| tags="${tag}" | |
| if [ "${version}" = "mysql-8.0-latest" ]; then | |
| tags="${tags},groonga/mroonga:latest" | |
| fi | |
| echo "::set-output name=push::${push}" | |
| echo "::set-output name=tag::${tag}" | |
| echo "::set-output name=tags::${tags}" | |
| - uses: actions/checkout@v4 | |
| - uses: docker/login-action@v3 | |
| if: steps.parse.outputs.push == 'true' | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - uses: docker/setup-buildx-action@v3 | |
| id: buildx | |
| - uses: docker/build-push-action@v6 | |
| id: docker_build | |
| with: | |
| # cache-from: type=gha | |
| # cache-to: type=gha,mode=max | |
| context: ${{ matrix.id }} | |
| push: ${{ steps.parse.outputs.push }} | |
| load: ${{ steps.parse.outputs.push != 'true' }} | |
| tags: ${{ steps.parse.outputs.tags }} | |
| - name: Image info | |
| run: | | |
| dockerfile=${{ matrix.id }}/Dockerfile | |
| mysql_version=$(grep -o 'mysql:[0-9.]*' ${dockerfile} | \ | |
| cut -d: -f2 | \ | |
| head -n1) | |
| mroonga_version=$(grep -o 'groonga_version=[0-9.]*' ${dockerfile} | \ | |
| cut -d: -f2 | \ | |
| head -n1) | |
| groonga_version=$(grep -o 'groonga_version=[0-9.]*' ${dockerfile} | \ | |
| cut -d: -f2 | \ | |
| head -n1) | |
| echo "MySQL ${mysql_version}, Mroonga ${mroonga_version}, Groonga ${groonga_version}" | tee release-title.txt | |
| cat <<RELEASE_NOTE | tee release-note.md | |
| * Commit: https://github.com/${GITHUB_REPOSITORY}/tree/${GITHUB_REF_NAME} | |
| * Tags: ${{ steps.parse.outputs.tags }} | |
| * Digest: \`${{ steps.docker_build.outputs.digest }}\` | |
| RELEASE_NOTE | |
| - name: Create GitHub Release | |
| if: github.ref_type == 'tag' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "${GITHUB_REF_NAME}" \ | |
| --discussion-category Announcements \ | |
| --notes-file release-note.md \ | |
| --title "$(cat release-title.txt)" | |
| - name: Test | |
| run: | | |
| ./test.sh \ | |
| "${{ matrix.id }}" \ | |
| "${{ steps.parse.outputs.tag }}" |