Compare commits

..

1 Commits

Author SHA1 Message Date
renovate[bot]
51b1979b8a chore(deps): update dependency eslint to v9 2024-05-09 09:45:53 +00:00
9 changed files with 578 additions and 422 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
github: [KengoTODA]

45
.github/workflows/semantic-tag.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: Publish semantic tags
on:
release:
types:
- published
permissions:
contents: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
# Release with semantic tag like v1.0.3
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- run: npm install semver
- name: Get versions
uses: actions/github-script@v7
id: batch
env:
TAG_NAME: ${{ github.event.release.tag_name }}
with:
script: |
const semver = require('semver')
const { TAG_NAME } = process.env
return {
minor: `v${semver.major(TAG_NAME).toString()}.${semver.minor(TAG_NAME).toString()}`,
major: `v${semver.major(TAG_NAME).toString()}`
}
- run: |
git tag -f "$MAJOR_VER"
git tag -f "$MINOR_VER"
git push origin -f "$MAJOR_VER"
git push origin -f "$MINOR_VER"
env:
MAJOR_VER: ${{ fromJSON(steps.batch.outputs.result).major }}
MINOR_VER: ${{ fromJSON(steps.batch.outputs.result).minor }}

64
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,64 @@
name: 'build-test'
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- 'releases/*'
jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Make sure the release step uses its own credentials.
persist-credentials: false
- uses: actions/setup-node@v4
with:
cache: npm
node-version-file: '.nvmrc'
- run: |
npm ci
npm run all
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run semantic-release
run: |
npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.PAT_TO_PUSH }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
test: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: ./
with:
version: '1.26.2'
- uses: ./
with:
version: '2.4.1'
- uses: ./
with:
version: 'v2.4.1'
- uses: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
actionlint:
runs-on: ubuntu-latest
if: github.event.pull_request
permissions:
contents: read
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-actionlint@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
reporter: github-pr-review

13
action.yml Normal file
View File

@@ -0,0 +1,13 @@
name: 'Setup docker-compose'
description: 'Automate download and set up process for docker-compose command'
author: 'Kengo TODA <skypencil@gmail.com>'
inputs:
version:
default: 'latest'
description: 'the version of docker-compose command'
branding:
color: blue
icon: play
runs:
using: 'node20'
main: 'dist/index.js'

8
dist/index.js vendored
View File

@@ -30,8 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.runCommand = runCommand;
exports.install = install;
exports.install = exports.runCommand = void 0;
const tool_cache_1 = __nccwpck_require__(7784);
const exec_1 = __nccwpck_require__(1514);
const core = __importStar(__nccwpck_require__(2186));
@@ -50,14 +49,14 @@ async function runCommand(command) {
}
return output.trim();
}
exports.runCommand = runCommand;
async function installOnLinux(version) {
const system = runCommand('uname -s');
const hardware = runCommand('uname -m');
if (!version.startsWith('v') && parseInt(version.split('.')[0], 10) >= 2) {
version = `v${version}`;
}
const url = `https://gh.api.99988866.xyz/https://github.com/docker/compose/releases/download/${version}/docker-compose-${await system}-${await hardware}`;
runCommand(`echo ${url}`);
const url = `https://github.com/docker/compose/releases/download/${version}/docker-compose-${await system}-${await hardware}`;
const installerPath = await (0, tool_cache_1.downloadTool)(url);
await (0, exec_1.exec)(`chmod +x ${installerPath}`);
const cachedPath = await (0, tool_cache_1.cacheFile)(installerPath, 'docker-compose', 'docker-compose', version);
@@ -83,6 +82,7 @@ async function install(version) {
throw new Error(`Unsupported platform: ${process.platform}`);
}
}
exports.install = install;
/***/ }),

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

833
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -39,14 +39,39 @@
"@types/node": "^20.0.0",
"@typescript-eslint/parser": "^7.0.0",
"@vercel/ncc": "^0.38.0",
"eslint": "^8.1.0",
"eslint": "^9.0.0",
"eslint-plugin-github": "^4.10.2",
"eslint-plugin-jest": "^28.0.0",
"jest": "^29.0.0",
"js-yaml": "^4.1.0",
"prettier": "3.3.3",
"semantic-release": "^24.0.0",
"prettier": "3.2.5",
"semantic-release": "^23.0.0",
"ts-jest": "^29.0.0",
"typescript": "^5.0.0"
},
"release": {
"branches": "main",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github",
[
"@semantic-release/exec",
{
"prepare": "npm run package"
}
],
[
"@semantic-release/git",
{
"assets": [
"dist",
"package.json"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
}

View File

@@ -24,8 +24,7 @@ async function installOnLinux(version: string): Promise<string> {
if (!version.startsWith('v') && parseInt(version.split('.')[0], 10) >= 2) {
version = `v${version}`
}
const url = `https://gh.api.99988866.xyz/https://github.com/docker/compose/releases/download/${version}/docker-compose-${await system}-${await hardware}`
runCommand(`echo ${url}`)
const url = `https://github.com/docker/compose/releases/download/${version}/docker-compose-${await system}-${await hardware}`
const installerPath = await downloadTool(url)
await exec(`chmod +x ${installerPath}`)
const cachedPath = await cacheFile(