Skip to content

[3006.x] Migrate workflows off AWS #7

[3006.x] Migrate workflows off AWS

[3006.x] Migrate workflows off AWS #7

---
name: Upload Release Artifact
on:
workflow_call:
inputs:
artifact-name:
type: string
required: true
description: The Salt version to set prior to building packages.
uload-url:
type: string
required: true
description: Release's upload url.
steps:
list-files:
name: List Files From Artifact
needs:
- create-github-release
runs-on: ubuntu-22.04
outputs:
files: ${{ steps.list-files.outputs.files }}
steps:
- uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: artifacts
- id: list-files
run: |
echo files="$(find artifacts -maxdepth 1 -type f -printf '%f\n' | jq -Rnc '[inputs | { file: "\(.)" }]')" >> "$GITHUB_OUTPUT"
upload-files:
name: Upload Source Tarball Artifacts
runs-on: ubuntu-22.04
needs:
- list-files
strategy:
matrix:
include: ${{ fromJSON(needs.list-files.outputs.files) }}
steps:
- uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: artifacts
- id: file-type
run: echo "file_type=$( file --mime-type artifacts/${{ matrix.file }} )" >> "$GITHUB_OUTPUT"
- name: Upload Source Tarball
id: upload-release-asset-source
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: artifacts/${{ matrix.file }}
asset_name: ${{ matrix.file }}
asset_content_type: ${{ steps.file-type.outputs.file_type }}