mirror of
https://code.forgejo.org/actions/setup-go
synced 2025-06-16 07:14:10 +02:00
Apply internal discussion agreements
This commit is contained in:
parent
17fabf6bf1
commit
f1f69d49da
5 changed files with 6 additions and 15 deletions
2
.github/workflows/versions.yml
vendored
2
.github/workflows/versions.yml
vendored
|
@ -24,7 +24,6 @@ jobs:
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
go-version: stable
|
go-version: stable
|
||||||
architecture: x64
|
|
||||||
- name: Verify Go
|
- name: Verify Go
|
||||||
run: go version
|
run: go version
|
||||||
|
|
||||||
|
@ -40,7 +39,6 @@ jobs:
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
go-version: oldstable
|
go-version: oldstable
|
||||||
architecture: x64
|
|
||||||
- name: Verify Go
|
- name: Verify Go
|
||||||
run: go version
|
run: go version
|
||||||
|
|
||||||
|
|
|
@ -722,7 +722,7 @@ describe('setup-go', () => {
|
||||||
expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...');
|
expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...');
|
||||||
expect(logSpy).toHaveBeenCalledWith('Added go to the path');
|
expect(logSpy).toHaveBeenCalledWith('Added go to the path');
|
||||||
expect(logSpy).toHaveBeenCalledWith(
|
expect(logSpy).toHaveBeenCalledWith(
|
||||||
`Successfully set up Go version ${patchVersion}`
|
`Successfully set up Go version ${versionSpec}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ export async function getGo(
|
||||||
return downloadPath;
|
return downloadPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function resolveVersionFromManifest(
|
async function resolveVersionFromManifest(
|
||||||
versionSpec: string,
|
versionSpec: string,
|
||||||
stable: boolean,
|
stable: boolean,
|
||||||
auth: string | undefined,
|
auth: string | undefined,
|
||||||
|
@ -358,7 +358,7 @@ export async function resolveStableVersionInput(
|
||||||
versionSpec: string,
|
versionSpec: string,
|
||||||
auth: string | undefined,
|
auth: string | undefined,
|
||||||
arch = os.arch(),
|
arch = os.arch(),
|
||||||
manifest: tc.IToolRelease[] | undefined
|
manifest: tc.IToolRelease[] | undefined,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
if (!manifest) {
|
if (!manifest) {
|
||||||
core.debug('No manifest cached');
|
core.debug('No manifest cached');
|
||||||
|
|
11
src/main.ts
11
src/main.ts
|
@ -8,7 +8,6 @@ import {isCacheFeatureAvailable} from './cache-utils';
|
||||||
import cp from 'child_process';
|
import cp from 'child_process';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import {IS_WINDOWS} from './utils';
|
|
||||||
|
|
||||||
export async function run() {
|
export async function run() {
|
||||||
try {
|
try {
|
||||||
|
@ -16,7 +15,7 @@ export async function run() {
|
||||||
// versionSpec is optional. If supplied, install / use from the tool cache
|
// versionSpec is optional. If supplied, install / use from the tool cache
|
||||||
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
|
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
|
||||||
//
|
//
|
||||||
let versionSpec = resolveVersionInput();
|
const versionSpec = resolveVersionInput();
|
||||||
|
|
||||||
const cache = core.getBooleanInput('cache');
|
const cache = core.getBooleanInput('cache');
|
||||||
core.info(`Setup go version spec ${versionSpec}`);
|
core.info(`Setup go version spec ${versionSpec}`);
|
||||||
|
@ -43,16 +42,12 @@ export async function run() {
|
||||||
manifest
|
manifest
|
||||||
);
|
);
|
||||||
|
|
||||||
if (IS_WINDOWS) {
|
const installDirVersion = path.basename(path.dirname(installDir));
|
||||||
versionSpec = installDir.split('\\').reverse()[1];
|
|
||||||
} else {
|
|
||||||
versionSpec = installDir.split('/').reverse()[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
core.addPath(path.join(installDir, 'bin'));
|
core.addPath(path.join(installDir, 'bin'));
|
||||||
core.info('Added go to the path');
|
core.info('Added go to the path');
|
||||||
|
|
||||||
const version = installer.makeSemver(versionSpec);
|
const version = installer.makeSemver(installDirVersion);
|
||||||
// Go versions less than 1.9 require GOROOT to be set
|
// Go versions less than 1.9 require GOROOT to be set
|
||||||
if (semver.lt(version, '1.9.0')) {
|
if (semver.lt(version, '1.9.0')) {
|
||||||
core.info('Setting GOROOT for Go version < 1.9');
|
core.info('Setting GOROOT for Go version < 1.9');
|
||||||
|
|
|
@ -2,5 +2,3 @@ export enum StableReleaseAlias {
|
||||||
Stable = 'stable',
|
Stable = 'stable',
|
||||||
OldStable = 'oldstable'
|
OldStable = 'oldstable'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const IS_WINDOWS = process.platform === 'win32';
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue