build-push-action/src/state-helper.ts
Claude fece9d42f3 refactor: remove tmpDir management and buildx installation
Since setup-docker-builder handles all infrastructure setup, build-push-action
no longer needs to:
- Install buildx (just assert it's available)
- Manage temporary directories (handled by actions toolkit)

Changes:
- Replace buildx installation with simple availability assertion
- Remove tmpDir state management entirely
- Remove buildx-version input parameter
- Clean up unused imports and functions

The action now assumes buildx is already configured by setup-docker-builder
or another setup action, making it simpler and more focused.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 14:49:31 -04:00

57 lines
2.4 KiB
TypeScript

import * as core from '@actions/core';
import {Inputs, sanitizeInputs} from './context';
export const inputs = process.env['STATE_inputs'] ? JSON.parse(process.env['STATE_inputs']) : undefined;
export const buildRef = process.env['STATE_buildRef'] || '';
export const isSummarySupported = !!process.env['STATE_isSummarySupported'];
export const blacksmithDockerBuildId = process.env['STATE_blacksmithDockerBuildId'] || '';
export const blacksmithClientKey = process.env['STATE_blacksmithClientKey'] || '';
export const blacksmithClientCaCertificate = process.env['STATE_blacksmithClientCaCertificate'] || '';
export const blacksmithRootCaCertificate = process.env['STATE_blacksmithRootCaCertificate'] || '';
export const dockerBuildStatus = process.env['STATE_dockerBuildStatus'] || '';
export const blacksmithBuilderLaunchTime = process.env['STATE_blacksmithBuilderLaunchTime'] || '';
export const dockerBuildDurationSeconds = process.env['STATE_dockerBuildDurationSeconds'] || '';
export function setInputs(inputs: Inputs) {
core.saveState('inputs', JSON.stringify(sanitizeInputs(inputs)));
}
export function setBuildRef(buildRef: string) {
core.saveState('buildRef', buildRef);
}
export function setSummarySupported() {
core.saveState('isSummarySupported', 'true');
}
export function setBlacksmithDockerBuildId(blacksmithDockerBuildId: string) {
core.saveState('blacksmithDockerBuildId', blacksmithDockerBuildId);
}
// setBlacksmithBuilderLaunchTime sets the time (in seconds) it took to launch the Blacksmith builder
export function setBlacksmithBuilderLaunchTime(blacksmithBuilderLaunchTime: string) {
core.saveState('blacksmithBuilderLaunchTime', blacksmithBuilderLaunchTime);
}
export function setBlacksmithClientKey(blacksmithClientKey: string) {
core.saveState('blacksmithClientKey', blacksmithClientKey);
}
export function setBlacksmithClientCaCertificate(blacksmithClientCaCertificate: string) {
core.saveState('blacksmithClientCaCertificate', blacksmithClientCaCertificate);
}
export function setBlacksmithRootCaCertificate(blacksmithRootCaCertificate: string) {
core.saveState('blacksmithRootCaCertificate', blacksmithRootCaCertificate);
}
export function setDockerBuildStatus(dockerBuildStatus: string) {
core.saveState('dockerBuildStatus', dockerBuildStatus);
}
export function setDockerBuildDurationSeconds(dockerBuildDurationSeconds: string) {
core.saveState('dockerBuildDurationSeconds', dockerBuildDurationSeconds);
}