[pull] main from imazen:main #68
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Test/Release" | |
on: | |
push: | |
branches: | |
- "*" | |
tags-ignore: | |
- "v*" | |
pull_request: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
env: | |
# env. context is not available, so we set these in github org vars | |
IMAGEFLOW_RELEASE_BUCKET: ${{ vars.IMAGEFLOW_RELEASE_BUCKET || 'imageflow-nightlies' }} | |
IMAGEFLOW_RELEASE_BUCKET_REGION: ${{ vars.IMAGEFLOW_RELEASE_BUCKET_REGION || 'us-west-1' }} | |
HTTPS_IMAGEFLOW_BUCKET: "https://s3.${{ vars.IMAGEFLOW_RELEASE_BUCKET_REGION }}.amazonaws.com/${{ vars.IMAGEFLOW_RELEASE_BUCKET }}" | |
# IMAGEFLOW_DOWNLOAD_COMMIT_BASE: "https://s3.${{ vars.IMAGEFLOW_RELEASE_BUCKET_REGION }}.amazonaws.com/${{ vars.IMAGEFLOW_RELEASE_BUCKET }}/commits/${{ github.sha }}/" | |
# IMAGEFLOW_TOOL_DOCKER_x64_FILE : "linux-musl-x64/imageflow_tool.tar.gz" | |
# IMAGEFLOW_TOOL_DOCKER_arm64_FILE : "linux-musl-arm64/imageflow_tool.tar.gz" | |
NUGET_UPLOAD_NUGET: ${{ secrets.NUGET_UPLOAD_NUGET }} | |
NUGET_UPLOAD_GITHUB: ${{ secrets.NUGET_UPLOAD_GITHUB }} | |
REL_NUGET_OUTPUT_DIR: "artifacts/nuget/" | |
PROFILE: release | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: linux-x64 | |
suffix: ubuntu-x86_64 | |
os: ubuntu-20.04 | |
target-cpu: x86-64 | |
commit-suffix: linux64 # used only for s3 commits/{suffix} folder | |
nuget-rid: linux-x64 | |
target: x86_64-unknown-linux-gnu | |
cross: 'true' | |
max-glibc: '2.29' | |
# skip-publish, for testing only. | |
- name: linux-x64-ubuntu-24 | |
suffix: ubuntu-x86_64-24 | |
os: ubuntu-24.04 | |
target-cpu: x86-64 | |
commit-suffix: linux64_24 | |
nuget-rid: linux-x64 | |
target: x86_64-unknown-linux-gnu | |
skip-publish: 'true' | |
- name: linux-arm64-ubuntu-22 | |
suffix: ubuntu-arm64 | |
os: ubuntu-22-arm-32gb #ubuntu-22.04-arm is in public preview | |
target-cpu: generic | |
commit-suffix: linux-arm64 | |
nuget-rid: linux-arm64 | |
target: aarch64-unknown-linux-gnu | |
features: neon | |
cross: 'true' | |
max-glibc: '2.34' | |
- name: osx-x64-13 | |
suffix: osx-x86_64 | |
os: macos-13 | |
target-cpu: haswell | |
commit-suffix: osx-x64 | |
nuget-rid: osx-x64 | |
target: x86_64-apple-darwin | |
- name: osx-arm64-14 | |
suffix: osx-arm64 | |
os: macos-14 | |
target-cpu: apple-m1 | |
commit-suffix: osx-arm64 | |
nuget-rid: osx-arm64 | |
target: aarch64-apple-darwin | |
- name: win-x64-2022 | |
suffix: win-x86_64 | |
os: windows-2022 | |
target-cpu: x86-64 | |
commit-suffix: win-x64 | |
nuget-rid: win-x64 | |
target: x86_64-pc-windows-msvc | |
- name: win-x86-2022 | |
suffix: win-x86 | |
os: windows-2022 | |
# target-cpu: generic # any target-cpu causes the build to fail | |
commit-suffix: win-x86 | |
nuget-rid: win-x86 | |
target: i686-pc-windows-msvc | |
- name: win-arm64-11 | |
suffix: win-arm64 | |
os: windows-11-arm-32gb | |
target-cpu: generic | |
commit-suffix: win-arm64 | |
nuget-rid: win-arm64 | |
target: aarch64-pc-windows-msvc | |
woa: 'true' | |
- name: linux-musl-x64 | |
suffix: linux-musl-x64 | |
commit-suffix: linux-musl-x64 | |
nuget-rid: linux-musl-x64 | |
os: ubuntu-24.04 | |
target-cpu: x86-64 | |
target: x86_64-unknown-linux-musl | |
features: mimalloc | |
cross: 'true' | |
static: true | |
docker-platform: linux/amd64 | |
docker-image: imazen/imageflow_tool | |
- name: linux-musl-arm64 | |
suffix: linux-musl-arm64 | |
commit-suffix: linux-musl-arm64 | |
nuget-rid: linux-musl-arm64 | |
os: ubuntu-22-arm-32gb #ubuntu-22.04-arm is in public preview | |
target-cpu: generic | |
target: aarch64-unknown-linux-musl | |
features: mimalloc | |
cross: 'true' | |
static: true | |
docker-platform: linux/arm64 | |
docker-image: imazen/imageflow_tool-arm64 | |
runs-on: ${{ matrix.os }} | |
name: "${{ (matrix.cross == 'true') && 'cross ' || ''}}${{ matrix.name }}${{ matrix.target-cpu && format(' cpu: {0}', matrix.target-cpu) }}${{ matrix.target && format(' target: {0}', matrix.target) }}${{ matrix.features && format(' features: {0}', matrix.features) }} runs-on:${{ matrix.os }}" | |
steps: | |
- name: "Goal: ${{ matrix.skip-publish != 'true' && github.event_name == 'release' && 'publish' || 'test' }} Imageflow.NativeRuntime.${{ matrix.suffix }} & Imageflow.NativeTool.${{ matrix.suffix }} with RID ${{ matrix.nuget-rid }}" | |
run: echo "Hi" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: "WOA: Setup Windows ARM64" | |
uses: ./.github/actions/setup-win-arm64 | |
if: matrix.woa == 'true' | |
- name: "WOA: Checkout code again with git, so git commands work." | |
uses: actions/checkout@v4 | |
if: matrix.woa == 'true' | |
- name: Test NuGet Package creation early | |
shell: bash | |
run: ./ci/pack_nuget/tests/run_all_tests.sh | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.name }} | |
if: matrix.cross != 'true' | |
- uses: dtolnay/rust-toolchain@stable | |
if: matrix.cross != 'true' && matrix.woa != 'true' | |
- name: Install NASM | |
uses: ./.github/actions/install-nasm | |
if: matrix.cross != 'true' && matrix.woa != 'true' | |
- name: Install i686 target | |
if: ${{ matrix.target == 'i686-pc-windows-msvc' && matrix.cross != 'true' }} | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: i686-pc-windows-msvc | |
- run: rustup show | |
# ---------------------------------------------------------------------------- | |
# Provides GITHUB_SHA_SHORT and others | |
# ---------------------------------------------------------------------------- | |
- uses: FranzDiebold/[email protected] | |
- name: Set EXTENSION to .zip or .tar.gz based on OS | |
shell: bash | |
run: echo "EXTENSION=${{ contains(matrix.os, 'windows') && 'zip' || 'tar.gz' }}" >> $GITHUB_ENV | |
- name: Set env vars | |
shell: bash | |
run: | | |
echo "TARGET_DIR=target/${{ matrix.target }}/" >> $GITHUB_ENV | |
echo "TAG_SHA_SUFFIX=${{ github.ref_name }}-${{ env.GITHUB_SHA_SHORT }}-${{ matrix.suffix }}" >> $GITHUB_ENV | |
echo "RUSTFLAGS=${{ matrix.target-cpu && format('-Ctarget-cpu={0}', matrix.target-cpu) }} ${{ matrix.target-feature && format('-Ctarget-feature={0}', matrix.target-feature) }}" >> $GITHUB_ENV | |
echo "CARGO_PROFILE_TARGET_FEATURES_ARGS=--${{ env.PROFILE }} ${{ matrix.target && format('--target={0}',matrix.target) }} ${{ matrix.features && format('--features={0}',matrix.features) }}" >> $GITHUB_ENV | |
echo "CROSS_ARGS=--locked --${{ env.PROFILE }} ${{ matrix.features && format('--features={0}',matrix.features) }}" >> $GITHUB_ENV | |
echo "REL_BINARIES_DIR=target/${{ matrix.target }}/${{ env.PROFILE }}/" >> $GITHUB_ENV | |
echo "BUILD_EXCLUDE=${{ matrix.build-exclude && format('--exclude={0}',matrix.build-exclude) }}" >> $GITHUB_ENV | |
echo "ALLOW_PUBLISH=${{ matrix.skip-publish != 'true' && github.event_name == 'release' && 'true' || 'false' }}" >> $GITHUB_ENV | |
echo "LIBIMAGEFLOW_DYNAMIC=${{ contains(matrix.target, 'win') && 'imageflow.dll' || contains(matrix.target, 'apple') && 'libimageflow.dylib' || 'libimageflow.so' }}" >> $GITHUB_ENV | |
echo "LIBIMAGEFLOW_STATIC=${{ contains(matrix.target, 'win') && 'imageflow.lib' || 'libimageflow.a' }}" >> $GITHUB_ENV | |
echo "IMAGEFLOW_TOOL=${{ contains(matrix.target, 'win') && 'imageflow_tool.exe' || 'imageflow_tool' }}" >> $GITHUB_ENV | |
- name: Set more env vars | |
shell: bash | |
run: | | |
echo "IMAGEFLOW_NUGET_VERSION=${{ github.ref_type == 'tag' && github.ref_name || 'vTEST' }}" >> $GITHUB_ENV | |
echo "IMAGEFLOW_TAG_SHA_SUFFIX=imageflow-${{ env.TAG_SHA_SUFFIX }}" >> $GITHUB_ENV | |
echo "IMAGEFLOW_TOOL_PATH=${{ env.REL_BINARIES_DIR }}imageflow_tool${{ contains(matrix.os, 'windows') && '.exe' || '' }}" >> $GITHUB_ENV | |
# We want to check these are successfully uploaded | |
echo "ESTIMATED_ARTIFACT_URL_COMMITS=${{ env.HTTPS_IMAGEFLOW_BUCKET }}/commits/${{ github.sha }}/${{ matrix.commit-suffix }}.${{ env.EXTENSION }}" >> $GITHUB_ENV | |
echo "ESTIMATED_MUSL_VERSIONED_URL=${{ env.HTTPS_IMAGEFLOW_BUCKET }}/static/${{ github.ref_name }}/${{ env.IMAGEFLOW_TAG_SHA_SUFFIX }}.${{ env.EXTENSION }}" >> $GITHUB_ENV | |
echo "ESTIMATED_MUSL_LATEST_URL=${{ env.HTTPS_IMAGEFLOW_BUCKET }}/static/latest/${{ matrix.target }}.${{ env.EXTENSION }}" >> $GITHUB_ENV | |
# These are compiled into the binaries using a build script. We might review to reduce them later. | |
echo "ESTIMATED_DOCS_URL=${{ env.HTTPS_IMAGEFLOW_BUCKET }}/doc" >> $GITHUB_ENV | |
echo "ESTIMATED_ARTIFACT_URL=${{ env.HTTPS_IMAGEFLOW_BUCKET }}/releases/${{ github.ref_name }}/${{ env.IMAGEFLOW_TAG_SHA_SUFFIX }}.${{ env.EXTENSION }}" >> $GITHUB_ENV | |
echo "CI_TAG=${{ github.ref_name }}" >> $GITHUB_ENV | |
echo "CI=True" >> $GITHUB_ENV | |
echo "CI_REPO=${{ github.repository }}" >> $GITHUB_ENV | |
echo "CI_JOB_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV | |
echo "CI_JOB_TITLE=GitHub ${{ github.job_id }} ${{ matrix.name }}" >> $GITHUB_ENV | |
echo "CI_STRING=GitHub actions" >> $GITHUB_ENV | |
echo "CI_PULL_REQUEST_INFO=${{ github.event_name !='release' }}" >> $GITHUB_ENV | |
echo "CI_BUILD_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV | |
echo "DEBUG=False" >> $GITHUB_ENV | |
echo "TARGET_CPU=${{ matrix.target-cpu }}" >> $GITHUB_ENV | |
- if: contains(matrix.target, 'musl') | |
name: "Edit imageflow_abi/Cargo.toml to build staticlib instead of cdylib and use strip and lto" | |
run: | | |
echo "Editing imageflow_abi/Cargo.toml to replace the cydlib with staticlib" | |
sed -i 's/\["cdylib"\]/\["staticlib"\]/g' imageflow_abi/Cargo.toml | |
echo "Editing ./Cargo.toml to remove all instances of '# enable on musl: '" | |
sed -i '/# enable on musl:/d' ./Cargo.toml | |
echo "Finished editing imageflow_abi/Cargo.toml: " | |
cat imageflow_abi/Cargo.toml | |
# TESTS --------------------------------------------------------------------- | |
- name: "cargo test --all --locked ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }}" | |
run: cargo test --all --locked ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }} | |
if: matrix.cross != 'true' && matrix.woa != 'true' | |
- name: "& Launch-VsDevShell.ps1 | cargo test --all ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }}" | |
run: "& Launch-VsDevShell.ps1 | cargo test --all ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }}" | |
shell: powershell | |
if: matrix.woa == 'true' | |
- name: "cross cargo test --target ${{ matrix.target }} ${{ env.CROSS_ARGS }}" | |
uses: houseabsolute/[email protected] | |
with: | |
command: "test" | |
target: ${{ matrix.target }} | |
args: "${{ env.CROSS_ARGS }}" | |
if: matrix.cross == 'true' | |
# BUILD --------------------------------------------------------------------- | |
- name: "cargo build --all ${{ env.BUILD_EXCLUDE }} ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }}" | |
if: matrix.cross != 'true' && matrix.woa != 'true' | |
run: cargo build --all ${{ env.BUILD_EXCLUDE }} ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }} | |
- name: "& Launch-VsDevShell.ps1 | cargo build --all ${{ env.BUILD_EXCLUDE }} ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }}" | |
if: matrix.woa == 'true' | |
run: "& Launch-VsDevShell.ps1 | cargo build --all ${{ env.BUILD_EXCLUDE }} ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }}" | |
shell: powershell | |
- name: "cross cargo build --target ${{ matrix.target }} ${{ env.CROSS_ARGS }}" | |
uses: houseabsolute/[email protected] | |
with: | |
command: "build" | |
target: ${{ matrix.target }} | |
args: "--all ${{ env.BUILD_EXCLUDE }} ${{ env.CROSS_ARGS }}" | |
if: matrix.cross == 'true' | |
# CHECK GLIBC --------------------------------------------------------------------- | |
- name: "Check GLIBC version and dynamic dependencies of ${{ env.LIBIMAGEFLOW_DYNAMIC }}" | |
if: matrix.max-glibc | |
run: | | |
chmod +x ./ci/check-glibc.sh | |
./ci/check-glibc.sh "${{ env.REL_BINARIES_DIR }}${{ env.LIBIMAGEFLOW_DYNAMIC }}" "${{ matrix.max-glibc }}" | |
shell: bash | |
# CHECK IMAGEFLOW_TOOL --------------------------------------------------------------------- | |
- run: "${{ env.IMAGEFLOW_TOOL_PATH }} diagnose --show-compilation-info" | |
shell: bash | |
# BUILD DOCUMENTATION --------------------------------------------------------------------- | |
- name: "Build ${{ env.PROFILE }} Docs" | |
run: cargo doc --all --no-deps ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }} | |
if: matrix.cross != 'true' | |
# CREATE ZIP/TAR FILES FOR UPLOAD --------------------------------------------------------------------- | |
- name: "Create zip/tar files for upload" # (always, so we know if it fails before we make a release) | |
shell: bash | |
run: | | |
chmod +x ./ci/pack_artifacts.sh | |
./ci/pack_artifacts.sh | |
env: | |
TARGET_DIR: ${{ env.TARGET_DIR }} | |
REL_BINARIES_DIR: ${{ env.REL_BINARIES_DIR }} | |
EXTENSION: ${{ env.EXTENSION }} | |
IMAGEFLOW_TAG_SHA_SUFFIX: ${{ env.IMAGEFLOW_TAG_SHA_SUFFIX }} | |
LIBIMAGEFLOW_STATIC: ${{ env.LIBIMAGEFLOW_STATIC }} | |
LIBIMAGEFLOW_DYNAMIC: ${{ env.LIBIMAGEFLOW_DYNAMIC }} | |
MATRIX_COMMIT_SUFFIX: ${{ matrix.commit-suffix }} | |
MATRIX_TARGET: ${{ matrix.target }} | |
HTTPS_UPLOAD_BASE: ${{ env.HTTPS_IMAGEFLOW_BUCKET }} | |
TAG_SHA_SUFFIX: ${{ env.TAG_SHA_SUFFIX }} | |
IMAGEFLOW_TOOL: ${{ env.IMAGEFLOW_TOOL }} | |
- name: "Create ${{ env.REL_NUGET_OUTPUT_DIR }}" | |
shell: bash | |
run: mkdir -p ${{ env.REL_NUGET_OUTPUT_DIR }} | |
# CREATE NUGET PACKAGE --------------------------------------------------------------------- | |
- name: "Create NuGet Package Imageflow.NativeTool.${{ matrix.nuget-rid }}" | |
shell: bash | |
run: ./ci/pack_nuget/pack.sh tool | |
env: | |
CI_TAG: ${{ env.IMAGEFLOW_NUGET_VERSION }} | |
PACKAGE_SUFFIX: ${{ matrix.suffix }} | |
NUGET_RUNTIME: ${{ matrix.nuget-rid }} | |
REPO_NAME: ${{ env.GITHUB_REPOSITORY_OWNER }}/${{ env.GITHUB_REPOSITORY_NAME }} | |
REL_BINARIES_DIR: "${{ env.REL_BINARIES_DIR }}" | |
REL_NUGET_OUTPUT_DIR: "${{ env.REL_NUGET_OUTPUT_DIR }}" | |
- name: "Create NuGet Package Imageflow.NativeRuntime.${{ matrix.nuget-rid }}" | |
if: ${{ !matrix.static }} | |
shell: bash | |
run: ./ci/pack_nuget/pack.sh | |
env: | |
CI_TAG: ${{ env.IMAGEFLOW_NUGET_VERSION }} | |
PACKAGE_SUFFIX: ${{ matrix.suffix }} | |
NUGET_RUNTIME: ${{ matrix.nuget-rid }} | |
REPO_NAME: ${{ env.GITHUB_REPOSITORY_OWNER }}/${{ env.GITHUB_REPOSITORY_NAME }} | |
REL_BINARIES_DIR: "${{ env.REL_BINARIES_DIR }}" | |
REL_NUGET_OUTPUT_DIR: "${{ env.REL_NUGET_OUTPUT_DIR }}" | |
# UPLOAD --------------------------------------------------------------------- | |
- name: "Upload to Github Release" | |
if: ${{ env.ALLOW_PUBLISH == 'true' }} | |
uses: xresloader/upload-to-github-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: "./artifacts/github/*.${{ env.EXTENSION }}" | |
tags: true | |
overwrite: true | |
verbose: true | |
- name: Upload ./artifacts/upload to S3 | |
if: ${{ env.ALLOW_PUBLISH == 'true' }} | |
uses: shallwefootball/s3-upload-action@master | |
with: | |
aws_key_id: ${{ secrets.AWS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}} | |
aws_bucket: ${{ env.IMAGEFLOW_RELEASE_BUCKET }} | |
source_dir: ./artifacts/upload | |
destination_dir: '' | |
- name: Publish to nuget.pkg.github.com | |
if: ${{ env.ALLOW_PUBLISH == 'true' && env.NUGET_UPLOAD_GITHUB == 'true' }} | |
run: | | |
for f in ./${{ env.REL_NUGET_OUTPUT_DIR }}*.nupkg | |
do | |
curl -vX PUT -u "${{github.repository_owner}}:${{ secrets.GITHUB_TOKEN }}" -F package=@$f https://nuget.pkg.github.com/${{github.repository_owner}}/ | |
done | |
shell: bash | |
- name: Publish to nuget.org | |
if: ${{ env.ALLOW_PUBLISH == 'true' && env.NUGET_UPLOAD_NUGET == 'true' }} | |
run: | | |
for f in ./${{ env.REL_NUGET_OUTPUT_DIR }}*.nupkg | |
do | |
curl -L "https://www.nuget.org/api/v2/package" -H "X-NuGet-ApiKey: ${{ secrets.NUGET_API_KEY }}" -H "X-NuGet-Client-Version: 4.1.0" -A "NuGet Command Line/3.4.4.1321 (Unix 4.4.0.92)" --upload-file "$f" --fail | |
done | |
shell: bash | |
- name: "Verify artifacts are now on S3, and public" | |
if: ${{ env.ALLOW_PUBLISH == 'true' }} | |
shell: bash | |
continue-on-error: true | |
run: | | |
# Function to test URL silently and return status | |
test_url() { | |
if curl -s -f -I "$1" 2>/dev/null >/dev/null; then | |
echo "✓ OK $1" | |
return 0 | |
else | |
echo "✗ FAILED $1" | |
return 1 | |
fi | |
} | |
# Test all relevant URLs | |
failed=0 | |
test_url "${{ env.ESTIMATED_ARTIFACT_URL }}" || failed=1 | |
test_url "${{ env.ESTIMATED_ARTIFACT_URL_COMMITS }}" || failed=1 | |
# Test MUSL-specific URLs if applicable | |
if [[ ${{ matrix.target }} == *"musl"* ]]; then | |
test_url "${{ env.ESTIMATED_MUSL_VERSIONED_URL }}" || failed=1 | |
test_url "${{ env.ESTIMATED_MUSL_LATEST_URL }}" || failed=1 | |
fi | |
# Exit with failure if any URL test failed | |
exit $failed | |
- name: From git, get 'latest' / 'main' / 'v1.2.3' tags | |
id: meta | |
if: ${{ contains(matrix.target, 'musl') }} | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.DOCKERHUB_REPO }} | |
${{ env.GHCR_REPO }} | |
- name: "Set up Docker Buildx" | |
if: ${{ contains(matrix.target, 'musl') }} | |
uses: docker/setup-buildx-action@v3 | |
- name: "Login to Docker Hub" | |
if: ${{ env.ALLOW_PUBLISH == 'true' && contains(matrix.target, 'musl') }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: "Copy imageflow_tool to docker context" | |
if: ${{ contains(matrix.target, 'musl') }} | |
run: cp ${{ env.IMAGEFLOW_TOOL_PATH }} ./docker/imageflow_tool/imageflow_tool | |
shell: bash | |
- name: "Build and push imageflow_tool Docker image" | |
if: ${{ contains(matrix.target, 'musl') }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./docker/imageflow_tool/ | |
file: ./docker/imageflow_tool/Dockerfile | |
# call: build (default I think) | |
platforms: ${{ matrix.docker-platform }} | |
push: ${{ env.ALLOW_PUBLISH == 'true' }} | |
labels: ${{ steps.meta.outputs.labels }} | |
nuget-meta-packages: | |
needs: [build] | |
runs-on: ubuntu-latest | |
name: "Meta NuGet packages like Imageflow.NativeRuntime.All, etc" | |
steps: | |
- name: "Goal: ${{ github.event_name == 'release' && 'publish' || 'test creating' }} Imageflow.NativeRuntime.All* && Imageflow.Net.All*" | |
run: echo "Hi" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: "Create ${{ env.REL_NUGET_OUTPUT_DIR }}" | |
shell: bash | |
run: mkdir -p ${{ env.REL_NUGET_OUTPUT_DIR }} | |
- name: Create nuget packages | |
shell: bash | |
run: ./ci/pack_nuget/pack_meta.sh | |
env: | |
CI_TAG: ${{ github.ref_type == 'tag' && github.ref_name || 'vTEST' }} | |
REPO_NAME: ${{ env.GITHUB_REPOSITORY_OWNER }}/${{ env.GITHUB_REPOSITORY_NAME }} | |
REL_NUGET_OUTPUT_DIR: "${{ env.REL_NUGET_OUTPUT_DIR }}" | |
- name: Publish to nuget.pkg.github.com | |
if: ${{ github.event_name == 'release' && env.NUGET_UPLOAD_GITHUB == 'true' }} | |
run: | | |
for f in ./${{ env.REL_NUGET_OUTPUT_DIR }}*.nupkg | |
do | |
curl -vX PUT -u "${{github.repository_owner}}:${{ secrets.GITHUB_TOKEN }}" -F package=@$f https://nuget.pkg.github.com/${{github.repository_owner}}/ | |
done | |
shell: bash | |
- name: Publish to nuget.org | |
if: ${{ github.event_name == 'release' && env.NUGET_UPLOAD_NUGET == 'true' }} | |
run: | | |
for f in ./${{ env.REL_NUGET_OUTPUT_DIR }}*.nupkg | |
do | |
curl -L "https://www.nuget.org/api/v2/package" -H "X-NuGet-ApiKey: ${{ secrets.NUGET_API_KEY }}" -H "X-NuGet-Client-Version: 4.1.0" -A "NuGet Command Line/3.4.4.1321 (Unix 4.4.0.92)" --upload-file "$f" --fail | |
done | |
shell: bash | |