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/ path: /tmp/jupyter/images/
- name: Load downloaded image to docker 📥 - name: Load downloaded image to docker 📥
run: | 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 docker image ls --all
shell: bash shell: bash

View File

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

View File

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

View File

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

View File

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