add cache key
This commit is contained in:
@@ -52,6 +52,16 @@ with:
|
|||||||
actions-cache-folder: '.xmake-cache'
|
actions-cache-folder: '.xmake-cache'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Use action cache with cachekey:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
uses: xmake-io/github-action-setup-xmake@v1
|
||||||
|
with:
|
||||||
|
xmake-version: '2.7.2'
|
||||||
|
actions-cache-folder: '.xmake-cache'
|
||||||
|
actions-cache-key: 'archlinux-ci'
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
### Prepare development environment
|
### Prepare development environment
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ inputs:
|
|||||||
actions-cache-folder:
|
actions-cache-folder:
|
||||||
description: 'Directory to cache xmake in. This folder will go under $GITHUB_HOME (I.e. build dir) and be cached using @actions/cache.'
|
description: 'Directory to cache xmake in. This folder will go under $GITHUB_HOME (I.e. build dir) and be cached using @actions/cache.'
|
||||||
default: ''
|
default: ''
|
||||||
|
actions-cache-key:
|
||||||
|
description: 'Actions cache key.'
|
||||||
|
default: ''
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
Vendored
+5
-1
@@ -70848,10 +70848,14 @@ async function unixInstall(version) {
|
|||||||
var _a;
|
var _a;
|
||||||
let toolDir = '';
|
let toolDir = '';
|
||||||
const actionsCacheFolder = core.getInput('actions-cache-folder');
|
const actionsCacheFolder = core.getInput('actions-cache-folder');
|
||||||
|
let actionsCacheKey = core.getInput('actions-cache-key');
|
||||||
|
if (!actionsCacheKey) {
|
||||||
|
actionsCacheKey = '';
|
||||||
|
}
|
||||||
if (version.type !== 'local') {
|
if (version.type !== 'local') {
|
||||||
const ver = version.version;
|
const ver = version.version;
|
||||||
const sha = version.sha;
|
const sha = version.sha;
|
||||||
const cacheKey = `xmake-cache-${ver}-${sha}-${os.arch()}-${os.platform()}-${(_a = process.env.RUNNER_OS) !== null && _a !== void 0 ? _a : 'unknown'}`;
|
const cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${os.arch()}-${os.platform()}-${(_a = process.env.RUNNER_OS) !== null && _a !== void 0 ? _a : 'unknown'}`;
|
||||||
if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) {
|
if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) {
|
||||||
const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, actionsCacheFolder);
|
const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, actionsCacheFolder);
|
||||||
try {
|
try {
|
||||||
|
|||||||
+5
-1
@@ -18,11 +18,15 @@ async function install(sourceDir: string, binDir: string): Promise<void> {
|
|||||||
export async function unixInstall(version: Version): Promise<void> {
|
export async function unixInstall(version: Version): Promise<void> {
|
||||||
let toolDir = '';
|
let toolDir = '';
|
||||||
const actionsCacheFolder = core.getInput('actions-cache-folder');
|
const actionsCacheFolder = core.getInput('actions-cache-folder');
|
||||||
|
let actionsCacheKey = core.getInput('actions-cache-key');
|
||||||
|
if (!actionsCacheKey) {
|
||||||
|
actionsCacheKey = '';
|
||||||
|
}
|
||||||
|
|
||||||
if (version.type !== 'local') {
|
if (version.type !== 'local') {
|
||||||
const ver = version.version;
|
const ver = version.version;
|
||||||
const sha = version.sha;
|
const sha = version.sha;
|
||||||
const cacheKey = `xmake-cache-${ver}-${sha}-${os.arch()}-${os.platform()}-${
|
const cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${os.arch()}-${os.platform()}-${
|
||||||
process.env.RUNNER_OS ?? 'unknown'
|
process.env.RUNNER_OS ?? 'unknown'
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user