add cleanup
This commit is contained in:
@@ -70,16 +70,6 @@ with:
|
|||||||
xmake-version: '2.9.7'
|
xmake-version: '2.9.7'
|
||||||
package-cache-folder: '.xmake-package-cache'
|
package-cache-folder: '.xmake-package-cache'
|
||||||
package-cache-key: 'archlinux-ci'
|
package-cache-key: 'archlinux-ci'
|
||||||
package-cache-status: 'load'
|
|
||||||
|
|
||||||
- install packages
|
|
||||||
...
|
|
||||||
|
|
||||||
uses: xmake-io/github-action-setup-xmake@v1
|
|
||||||
with:
|
|
||||||
package-cache-folder: '.xmake-package-cache'
|
|
||||||
package-cache-key: 'archlinux-ci'
|
|
||||||
package-cache-status: 'save'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Cache build
|
### Cache build
|
||||||
@@ -90,16 +80,6 @@ with:
|
|||||||
xmake-version: '2.9.7'
|
xmake-version: '2.9.7'
|
||||||
build-cache-folder: '.xmake-build-cache'
|
build-cache-folder: '.xmake-build-cache'
|
||||||
build-cache-key: 'archlinux-ci'
|
build-cache-key: 'archlinux-ci'
|
||||||
build-cache-status: 'load'
|
|
||||||
|
|
||||||
- build project
|
|
||||||
...
|
|
||||||
|
|
||||||
uses: xmake-io/github-action-setup-xmake@v1
|
|
||||||
with:
|
|
||||||
build-cache-folder: '.xmake-build-cache'
|
|
||||||
build-cache-key: 'archlinux-ci'
|
|
||||||
build-cache-status: 'save'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|||||||
@@ -22,18 +22,12 @@ inputs:
|
|||||||
package-cache-key:
|
package-cache-key:
|
||||||
description: The packages cache key.
|
description: The packages cache key.
|
||||||
default: ''
|
default: ''
|
||||||
package-cache-status:
|
|
||||||
description: The packages cache status, e.g. load/save.
|
|
||||||
default: ''
|
|
||||||
build-cache-folder:
|
build-cache-folder:
|
||||||
description: 'Directory to cache build artifacts in. This folder will go under $GITHUB_HOME (I.e. build dir) and be cached using @actions/cache.'
|
description: 'Directory to cache build artifacts in. This folder will go under $GITHUB_HOME (I.e. build dir) and be cached using @actions/cache.'
|
||||||
default: ''
|
default: ''
|
||||||
build-cache-key:
|
build-cache-key:
|
||||||
description: The build cache key.
|
description: The build cache key.
|
||||||
default: ''
|
default: ''
|
||||||
build-cache-status:
|
|
||||||
description: The build cache status, e.g. load/save.
|
|
||||||
default: ''
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node20'
|
using: 'node20'
|
||||||
|
|||||||
+17
-1
@@ -2,6 +2,7 @@ import * as core from '@actions/core';
|
|||||||
import { exec } from '@actions/exec';
|
import { exec } from '@actions/exec';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import { selectVersion } from './versions';
|
import { selectVersion } from './versions';
|
||||||
|
import * as stateHelper from './state-helper'
|
||||||
import { winInstall } from './win-install';
|
import { winInstall } from './win-install';
|
||||||
import { unixInstall } from './unix-install';
|
import { unixInstall } from './unix-install';
|
||||||
|
|
||||||
@@ -27,4 +28,19 @@ async function run(): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
run().catch((e: Error) => core.error(e));
|
|
||||||
|
async function cleanup(): Promise<void> {
|
||||||
|
try {
|
||||||
|
core.info(`cleanup`);
|
||||||
|
} catch (error) {
|
||||||
|
const ex = error as Error;
|
||||||
|
core.setFailed(ex.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stateHelper.IsPost) {
|
||||||
|
run().catch((e: Error) => core.error(e));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cleanup().catch((e: Error) => core.error(e));
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user