chore(deps): bump rexml from 3.2.4 to 3.4.2 in /ruby-jekyll #34
Workflow file for this run
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: PR Buildx Test | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build-stratigy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - id: set-matrix | |
| run: | | |
| sudo apt-get install jq | |
| echo "::set-output name=matrix::$(bash prepare.sh)" | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| builder: | |
| needs: build-stratigy | |
| strategy: | |
| max-parallel: 2 | |
| matrix: | |
| dirs: ${{fromJson(needs.build-stratigy.outputs.matrix)}} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Init builder | |
| id: pre-build | |
| run: | | |
| dir=${{ matrix.dirs }} | |
| echo ::set-output name=org_name::"techthinkerorg" | |
| echo ::set-output name=image_name::"$dir" | |
| echo ::set-output name=version::$(head -n1 "${dir}/.version") | |
| echo ::set-output name=arch::$(head -n1 "${dir}/.arch") | |
| echo ::set-output name=forced::$([ -f "${dir}/.forced" ] && echo 'true' || echo 'false') | |
| - name: Prepare | |
| id: prepare | |
| run: | | |
| DOCKER_IMAGE=${{steps.pre-build.outputs.org_name}}/${{steps.pre-build.outputs.image_name}} | |
| DOCKER_PLATFORMS=${{steps.pre-build.outputs.arch}} | |
| VERSION=${{steps.pre-build.outputs.version}} | |
| TAGS="--tag ${DOCKER_IMAGE}:${VERSION}" | |
| if [ $VERSION = latest -o $VERSION = nightly ]; then | |
| TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest" | |
| fi | |
| echo ::set-output name=docker_image::${DOCKER_IMAGE} | |
| echo ::set-output name=version::${VERSION} | |
| echo ::set-output name=buildx_args::--file ${{steps.pre-build.outputs.image_name}}/Dockerfile \ | |
| --platform ${DOCKER_PLATFORMS} \ | |
| --build-arg VERSION=${VERSION} \ | |
| --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ | |
| --build-arg VCS_REF=${GITHUB_SHA::8} \ | |
| ${TAGS} . | |
| - name: Check If Image Exists | |
| id: check-image | |
| run: | | |
| UNAME=${{ secrets.DOCKER_USERNAME }} | |
| UPASS=${{ secrets.DOCKER_PASSWORD }} | |
| DOCKER_IMAGE=${{steps.pre-build.outputs.org_name}}/${{steps.pre-build.outputs.image_name}} | |
| VERSION=${{steps.pre-build.outputs.version}} | |
| function docker_tag_exists() { | |
| TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${UNAME}'", "password": "'${UPASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token) | |
| curl --silent -f --head -lL https://hub.docker.com/v2/repositories/$1/tags/$2/ > /dev/null | |
| } | |
| if docker_tag_exists ${DOCKER_IMAGE} ${VERSION}; then | |
| echo "Docker image ${DOCKER_IMAGE}:${VERSION} already exists" | |
| echo ::set-output name=build_needed::${{ steps.pre-build.outputs.forced }} | |
| else | |
| echo "Docker image ${DOCKER_IMAGE}:${VERSION} does not exist" | |
| echo ::set-output name=build_needed::'true' | |
| fi | |
| - name: Set up QEMU | |
| if: ${{ steps.check-image.outputs.build_needed == 'true' }} | |
| uses: docker/setup-qemu-action@v1 | |
| with: | |
| platforms: all | |
| - name: Set up Docker Buildx | |
| if: ${{ steps.check-image.outputs.build_needed == 'true' }} | |
| id: buildx | |
| uses: docker/setup-buildx-action@v1 | |
| with: | |
| version: latest | |
| - name: Available platforms | |
| if: ${{ steps.check-image.outputs.build_needed == 'true' }} | |
| run: echo ${{ steps.buildx.outputs.platforms }} | |
| - name: Docker Buildx (build) | |
| if: ${{ steps.check-image.outputs.build_needed == 'true' }} | |
| run: | | |
| docker buildx build --no-cache --pull --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }} | |
| - name: Clear | |
| if: always() && github.event_name != 'pull_request' | |
| run: | | |
| rm -f ${HOME}/.docker/config.json |