Unify multiline run statements in GitHub Actions steps (#2272)

This commit is contained in:
Ayaz Salikhov
2025-04-01 01:58:06 +01:00
committed by GitHub
parent b98e55e28d
commit abd7d12641
5 changed files with 60 additions and 53 deletions

View File

@@ -22,6 +22,11 @@ runs:
path: /tmp/jupyter/images/
- name: Load downloaded image to docker 📥
run: |
zstd --uncompress --stdout --rm /tmp/jupyter/images/${{ inputs.image }}-${{ inputs.platform }}-${{ inputs.variant }}.tar.zst | docker load
zstd \
--uncompress \
--stdout \
--rm \
/tmp/jupyter/images/${{ inputs.image }}-${{ inputs.platform }}-${{ inputs.variant }}.tar.zst \
| docker load
docker image ls --all
shell: bash

View File

@@ -63,13 +63,13 @@ jobs:
shell: bash
- name: Build image 🛠
run: >
docker build
--rm --force-rm
--tag ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ inputs.image }}
images/${{ inputs.image }}/${{ inputs.variant != 'default' && inputs.variant || '.' }}/
--build-arg REGISTRY=${{ env.REGISTRY }}
--build-arg OWNER=${{ env.OWNER }}
run: |
docker build \
--rm --force-rm \
--tag ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ inputs.image }} \
images/${{ inputs.image }}/${{ inputs.variant != 'default' && inputs.variant || '.' }}/ \
--build-arg REGISTRY=${{ env.REGISTRY }} \
--build-arg OWNER=${{ env.OWNER }}
env:
DOCKER_BUILDKIT: 1
# Full logs for CI build
@@ -77,13 +77,13 @@ jobs:
shell: bash
- name: Write tags file 🏷
run: >
python3 -m tagging.apps.write_tags_file
--registry ${{ env.REGISTRY }}
--owner ${{ env.OWNER }}
--image ${{ inputs.image }}
--variant ${{ inputs.variant }}
--tags-dir /tmp/jupyter/tags/
run: |
python3 -m tagging.apps.write_tags_file \
--registry ${{ env.REGISTRY }} \
--owner ${{ env.OWNER }} \
--image ${{ inputs.image }} \
--variant ${{ inputs.variant }} \
--tags-dir /tmp/jupyter/tags/
shell: bash
- name: Upload tags file 💾
uses: actions/upload-artifact@v4
@@ -93,15 +93,15 @@ jobs:
retention-days: 3
- name: Write manifest and build history file 🏷
run: >
python3 -m tagging.apps.write_manifest
--registry ${{ env.REGISTRY }}
--owner ${{ env.OWNER }}
--image ${{ inputs.image }}
--variant ${{ inputs.variant }}
--hist-lines-dir /tmp/jupyter/hist_lines/
--manifests-dir /tmp/jupyter/manifests/
--repository ${{ github.repository }}
run: |
python3 -m tagging.apps.write_manifest \
--registry ${{ env.REGISTRY }} \
--owner ${{ env.OWNER }} \
--image ${{ inputs.image }} \
--variant ${{ inputs.variant }} \
--hist-lines-dir /tmp/jupyter/hist_lines/ \
--manifests-dir /tmp/jupyter/manifests/ \
--repository ${{ github.repository }}
shell: bash
- name: Upload manifest file 💾
uses: actions/upload-artifact@v4
@@ -119,7 +119,9 @@ jobs:
- name: Save image as a tar for later use 💾
run: |
mkdir -p /tmp/jupyter/images/
docker save ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ inputs.image }} | zstd > /tmp/jupyter/images/${{ inputs.image }}-${{ inputs.platform }}-${{ inputs.variant }}.tar.zst
docker save \
${{ env.REGISTRY }}/${{ env.OWNER }}/${{ inputs.image }} \
| zstd > /tmp/jupyter/images/${{ inputs.image }}-${{ inputs.platform }}-${{ inputs.variant }}.tar.zst
shell: bash
- name: Upload image as artifact 💾
uses: actions/upload-artifact@v4
@@ -130,9 +132,9 @@ jobs:
compression-level: 0
- name: Run tests ✅
run: >
python3 -m tests.run_tests
--registry ${{ env.REGISTRY }}
--owner ${{ env.OWNER }}
--image ${{ inputs.image }}
run: |
python3 -m tests.run_tests \
--registry ${{ env.REGISTRY }} \
--owner ${{ env.OWNER }} \
--image ${{ inputs.image }}
shell: bash

View File

@@ -61,14 +61,14 @@ jobs:
name: ${{ inputs.image }}-${{ inputs.platform }}-${{ inputs.variant }}-tags
path: /tmp/jupyter/tags/
- name: Apply tags to the loaded image 🏷
run: >
python3 -m tagging.apps.apply_tags
--registry ${{ env.REGISTRY }}
--owner ${{ env.OWNER }}
--image ${{ inputs.image }}
--variant ${{ inputs.variant }}
--platform ${{ inputs.platform }}
--tags-dir /tmp/jupyter/tags/
run: |
python3 -m tagging.apps.apply_tags \
--registry ${{ env.REGISTRY }} \
--owner ${{ env.OWNER }} \
--image ${{ inputs.image }} \
--variant ${{ inputs.variant }} \
--platform ${{ inputs.platform }} \
--tags-dir /tmp/jupyter/tags/
# This step is needed to prevent pushing non-multi-arch "latest" tag
- name: Remove the "latest" tag from the image 🗑️
run: docker image rmi ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ inputs.image }}:latest

View File

@@ -40,12 +40,12 @@ jobs:
path: wiki_src/
- name: Update wiki 🏷
run: >
python3 -m wiki.update_wiki
--wiki-dir wiki_src/
--hist-lines-dir /tmp/jupyter/hist_lines/
--manifests-dir /tmp/jupyter/manifests/
--repository ${{ github.repository }}
run: |
python3 -m wiki.update_wiki \
--wiki-dir wiki_src/ \
--hist-lines-dir /tmp/jupyter/hist_lines/ \
--manifests-dir /tmp/jupyter/manifests/ \
--repository ${{ github.repository }}
shell: bash
- name: Push Wiki to GitHub 📤

View File

@@ -33,18 +33,18 @@ jobs:
- name: Login to Quay.io 🔐
if: env.PUSH_TO_REGISTRY == 'true'
run: >
skopeo login quay.io
--username ${{ secrets.QUAY_USERNAME }}
--password ${{ secrets.QUAY_ROBOT_TOKEN }}
run: |
skopeo login quay.io \
--username ${{ secrets.QUAY_USERNAME }} \
--password ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Move image from Docker Hub to Quay.io 🐳
if: env.PUSH_TO_REGISTRY == 'true'
run: >
skopeo copy
--multi-arch all
docker://${{ env.OWNER }}/${{ matrix.image }}:${{ matrix.tag }}
docker://quay.io/${{ env.OWNER }}/${{ matrix.image }}:${{ matrix.tag }}
run: |
skopeo copy \
--multi-arch all \
docker://${{ env.OWNER }}/${{ matrix.image }}:${{ matrix.tag }} \
docker://quay.io/${{ env.OWNER }}/${{ matrix.image }}:${{ matrix.tag }}
strategy:
fail-fast: false