brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 087e3dc Raw
45 lines · yaml
1name: Push Container2description: >-3  Download all container artifacts for this job and push them to the GitHub registry.4 5inputs:6  token:7    description: >-8      Token to use to authenticate with the container registry.9    required: true10 11runs:12  using: "composite"13  steps:14    - name: Download container15      uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.016 17    - name: Push Container18      env:19        GITHUB_TOKEN: ${{ inputs.token }}20      shell: bash21      run: |22        function push_container {23          image_name=$124          latest_name=$(echo $image_name | sed 's/:[a-f0-9]\+$/:latest/g')25          podman tag $image_name $latest_name26          echo "Pushing $image_name ..."27          podman push --compression-format=zstd $image_name28          echo "Pushing $latest_name ..."29          podman push --compression-format=zstd $latest_name30        }31 32        podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io33        for f in $(find . -iname '*.tar'); do34          image_name=$(podman load -q -i $f | sed 's/Loaded image: //g')35          push_container $image_name36 37          if echo $image_name | grep '/amd64/'; then38            # For amd64, create an alias with the arch component removed.39            # This matches the convention used on dockerhub.40            default_image_name=$(echo $(dirname $(dirname $image_name))/$(basename $image_name))41            podman tag $image_name $default_image_name42            push_container $default_image_name43          fi44        done45