Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release fallbacks #13

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sour-wombats-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'build-uploader': patch
---

Updated logs, some type fixes
30 changes: 28 additions & 2 deletions scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,32 @@ const main = async () => {
stdio: 'inherit',
});

const [major, minor] = version.split('.');
const majorTag = `v${major}`;
const minorTag = `v${major}.${minor}`;

try {
execSync(`git tag -f ${majorTag}`, { stdio: 'inherit' });

execSync(`git push origin ${majorTag} --force`, {
stdio: 'inherit',
});
console.log(`Updated tag: ${majorTag}`);
} catch (error: any) {
console.error(`Failed to update ${majorTag}:`, error.message);
}

try {
execSync(`git tag -f ${minorTag}`, { stdio: 'inherit' });

execSync(`git push origin ${minorTag} --force`, {
stdio: 'inherit',
});
console.log(`Updated tag: ${minorTag}`);
} catch (error: any) {
console.error(`Failed to update ${minorTag}:`, error.message);
}

execSync(
`gh release create v${version} --title "v${version}" --notes "${releaseNotes || 'No changes'}"`,
{
Expand All @@ -57,8 +83,8 @@ const main = async () => {
);

console.log(`Successfully created and pushed release v${version}`);
} catch (error) {
console.error('Error creating release:', (error as Error).message);
} catch (error: any) {
console.error('Error creating release:', error.message);
process.exit(1);
}
};
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import * as core from '@actions/core';
import { run } from './run';

run()
.then(() => {
core.info('Build upload process completed successfully');
.then((buildId) => {
core.info(
`Build upload process completed successfully for build ID: ${buildId}`
);
})
.catch((error) => {
core.setFailed(`Unable to upload build due to error: ${error.message}`);
Expand Down
7 changes: 4 additions & 3 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { createBuild } from './createBuild';
import { uploadBuild } from './uploadBuild';
import { completeBuild } from './completeBuild';

export async function run() {
export async function run(): Promise<string> {
const apiKey = core.getInput('apiKey', { required: true });
const apiBaseUrl = core.getInput('apiBaseUrl', { required: true });
const gameId = core.getInput('gameId', { required: true });
const windowsBuildPath: string | null = core.getInput('windowsBuildPath', {
const windowsBuildPath = core.getInput('windowsBuildPath', {
required: false,
});
const macosBuildPath: string | null = core.getInput('macosBuildPath', {
const macosBuildPath = core.getInput('macosBuildPath', {
required: false,
});

Expand Down Expand Up @@ -75,4 +75,5 @@ export async function run() {
});

core.setOutput('buildId', buildId);
return buildId;
}
Loading