INNER CODE UNIT · Python

main

alper-han/CrossMacro · scripts/ci/nuget-cache.py:74

def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument('command', choices=['prepare', 'collect', 'restored', 'summary'])
    args = parser.parse_args()
    feed = Path(os.environ['RUNNER_TEMP']) / 'crossmacro-nuget-feed'
    state = Path(os.environ['RUNNER_TEMP']) / 'crossmacro-nuget-cache.json'
    if args.command == 'prepare':
        profile = os.environ['CACHE_PROFILE']
        if profile not in {'source', 'publish'}:
            raise ValueError('Unknown NuGet cache profile')
        feed.mkdir(parents=True, exist_ok=True)
        prefix = f"nuget-archives-v1-{os.environ['RUNNER_OS']}-{os.environ['RUNNER_ARCH']}-{profile}-{os.environ['CACHE_SDK']}-"
        key = prefix + fingerprint(Path.cwd(), profile, os.environ['RUNNER_OS'])
        writer = (os.environ.get('CACHE_WRITER') == 'true'
                  and os.environ.get('GITHUB_EVENT_NAME') in {'push', 'workflow_dispatch'}
                  and os.environ.get('GITHUB_REF') in {'refs/heads/dev', 'refs/heads/main'})
        append(os.environ['GITHUB_OUTPUT'], {'key': key, 'prefix': prefix, 'path': feed, 'writer': str(writer).lower()})
        # NuGet extracts and verifies packages normally; the configured remote

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…