name: builder
on:
workflow_dispatch:
inputs:
tag_name:
description: "The tag name of the release to add assets to (e.g., v1.0.0)"
required: true
asset_folder:
description: "Path to the folder containing assets (relative to repo root, e.g., artifacts)"
required: true
default: "artifacts"
jobs:
builder:
name: Upload release assets
runs-on: ubuntu-latest
outputs:
outcome: ${{ steps.upload.outcome }}
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get SHA of tag_name
id: get_sha
run: |
SHA=$(git rev-list -n 1 ${{ inputs.tag_name }})
echo "sha=$SHA" >> $GITHUB_OUTPUT
- uses: julia-actions/setup-julia@v2
with:
version: "1.7"
- run: TAG_NAME='${{ inputs.tag_name }}' SHA='${{ steps.get_sha.outputs.sha }}' julia -- ./.ci/release.jl
- name: List files in folder
run: |
echo "Looking for assets in folder: ${{ github.workspace }}/${{ inputs.asset_folder }}"
ls -l "${{ github.workspace }}/${{ inputs.asset_folder }}"
- name: Upload assets to release
id: upload
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
TAG_NAME: ${{ inputs.tag_name }}
ASSET_FOLDER: ${{ inputs.asset_folder }}
run: |
# Check if folder exists and is not empty
if [ -d "$ASSET_FOLDER" ] && [ "$(ls -A $ASSET_FOLDER)" ]; then
echo "Uploading assets from $ASSET_FOLDER to release $TAG_NAME..."
# Use find to handle files potentially containing spaces or special characters
# Upload files one by one to avoid issues with too many arguments for gh release upload *
find "$ASSET_FOLDER" -maxdepth 1 -type f -print0 | while IFS= read -r -d $'\0' file; do
echo "Uploading '$file'..."
gh release upload "$TAG_NAME" "$file" --clobber
done
echo "Asset upload complete."
else
echo "Warning: Asset folder '$ASSET_FOLDER' not found or is empty. No assets uploaded."
fi
badge:
runs-on: ubuntu-latest
needs: builder
if: always()
steps:
- name: passing
if: needs.builder.outputs.outcome == 'success'
uses: SimplePixelFont/badge-spf-action@main
with:
filename: compatibility.png
label: Compatibility
message: passing
labelColor: "#2d3136"
color: "#00bfa3"
logo: "https://raw.githubusercontent.com/The-Nice-One/GalleryArt/refs/heads/main/emojis_flattened/version_control.png"
font: "https://raw.githubusercontent.com/SimplePixelFont/web-spf/refs/heads/main/Monogram5x8-light.spf"
- name: failing
if: needs.builder.outputs.outcome == 'failure' || needs.builder.outputs.outcome == 'cancelled' || needs.builder.outputs.outcome == 'skipped'
uses: SimplePixelFont/badge-spf-action@main
with:
filename: compatibility.png
label: Compatibility
message: failing
labelColor: "#2d3136"
color: "#d94a69"
logo: "https://raw.githubusercontent.com/The-Nice-One/GalleryArt/refs/heads/main/emojis_flattened/version_control.png"
font: "https://raw.githubusercontent.com/SimplePixelFont/web-spf/refs/heads/main/Monogram5x8-light.spf"
- name: deploy
uses: exuanbo/actions-deploy-gist@v1
with:
token: ${{ secrets.GIST_SECRET }}
gist_id: cfebb0fe555ac7e77ada109c469cdeb4
file_path: compatibility.png
file_type: binary