Compare commits
1 Commits
v1.1.0
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b60e4772d |
@@ -11,7 +11,6 @@
|
|||||||
"eslint-comments/no-use": "off",
|
"eslint-comments/no-use": "off",
|
||||||
"import/no-namespace": "off",
|
"import/no-namespace": "off",
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"i18n-text/no-en": "off",
|
|
||||||
"@typescript-eslint/no-unused-vars": "error",
|
"@typescript-eslint/no-unused-vars": "error",
|
||||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
||||||
"@typescript-eslint/no-require-imports": "error",
|
"@typescript-eslint/no-require-imports": "error",
|
||||||
|
|||||||
45
.github/workflows/semantic-tag.yml
vendored
45
.github/workflows/semantic-tag.yml
vendored
@@ -1,45 +0,0 @@
|
|||||||
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@v3
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.release.tag_name }}
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
- run: npm install semver
|
|
||||||
- name: Get versions
|
|
||||||
uses: actions/github-script@v6
|
|
||||||
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 }}
|
|
||||||
22
.github/workflows/test.yml
vendored
22
.github/workflows/test.yml
vendored
@@ -21,8 +21,6 @@ jobs:
|
|||||||
- run: |
|
- run: |
|
||||||
npm ci
|
npm ci
|
||||||
npm run all
|
npm run all
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Run semantic-release
|
- name: Run semantic-release
|
||||||
run: |
|
run: |
|
||||||
npx semantic-release
|
npx semantic-release
|
||||||
@@ -31,8 +29,6 @@ jobs:
|
|||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
test: # make sure the action works on a clean machine without building
|
test: # make sure the action works on a clean machine without building
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: ./
|
- uses: ./
|
||||||
@@ -44,21 +40,3 @@ jobs:
|
|||||||
- uses: ./
|
- uses: ./
|
||||||
with:
|
with:
|
||||||
version: 'v2.4.1'
|
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@v3
|
|
||||||
- uses: reviewdog/action-actionlint@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
reporter: github-pr-review
|
|
||||||
|
|||||||
15
README.md
15
README.md
@@ -12,18 +12,7 @@ Add a step to your workflow like below:
|
|||||||
steps:
|
steps:
|
||||||
- uses: KengoTODA/actions-setup-docker-compose@main
|
- uses: KengoTODA/actions-setup-docker-compose@main
|
||||||
with:
|
with:
|
||||||
version: '2.14.2' # the full version of `docker-compose` command
|
version: '1.29.2'
|
||||||
```
|
```
|
||||||
|
|
||||||
Or you can omit it then set a `GITHUB_TOKEN` environment variable, to use the latest released version:
|
The `version` parameter is required, specify the full version of `docker-compose` command.
|
||||||
|
|
||||||
```yml
|
|
||||||
steps:
|
|
||||||
- uses: KengoTODA/actions-setup-docker-compose@main
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
```
|
|
||||||
|
|
||||||
The 'latest release' here means [the most recent non-prerelease, non-draft release, sorted by the created_at attribute](https://octokit.github.io/rest.js/v19#repos-get-latest-release).
|
|
||||||
|
|
||||||
Note that the `GITHUB_TOKEN` should have [`contents: read` permission](https://docs.github.com/en/rest/overview/permissions-required-for-github-apps?apiVersion=2022-11-28#contents) to fetch data from the GitHub.com.
|
|
||||||
|
|||||||
@@ -1,27 +1,23 @@
|
|||||||
import {install, runCommand} from '../src/install'
|
import {install, runCommand} from '../src/install'
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
|
|
||||||
import {describe, expect, it, test} from '@jest/globals'
|
import {expect, test} from '@jest/globals'
|
||||||
|
|
||||||
describe('runCommand', () => {
|
test('runCommand', async () => {
|
||||||
it('runs a command and returns its stdout', async () => {
|
|
||||||
const result = await runCommand('echo foo bar')
|
const result = await runCommand('echo foo bar')
|
||||||
expect(result).toBe('foo bar')
|
expect(result).toBe('foo bar')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('install', () => {
|
async function testVersion(version: string) {
|
||||||
const cases = ['1.29.1', '1.29.2', '2.2.3', 'v2.2.3', 'v2.10.2']
|
|
||||||
test.each(cases)('can install version %p', async (version: string) => {
|
|
||||||
const commandPath = await install(version)
|
const commandPath = await install(version)
|
||||||
core.addPath(commandPath)
|
core.addPath(commandPath)
|
||||||
const result = await runCommand('docker-compose version')
|
const result = await runCommand('docker-compose version')
|
||||||
expect(result).toContain(version)
|
expect(result).toContain(version)
|
||||||
})
|
}
|
||||||
it('can install latest version', async () => {
|
|
||||||
const commandPath = await install('latest')
|
test('Install the right version', async () => {
|
||||||
core.addPath(commandPath)
|
await testVersion('1.29.1')
|
||||||
const result = await runCommand('docker-compose version')
|
await testVersion('1.29.2')
|
||||||
expect(result).not.toBeFalsy()
|
await testVersion('2.2.3')
|
||||||
})
|
await testVersion('v2.2.3')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ description: 'Automate download and set up process for docker-compose command'
|
|||||||
author: 'Kengo TODA <skypencil@gmail.com>'
|
author: 'Kengo TODA <skypencil@gmail.com>'
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
default: 'latest'
|
required: true
|
||||||
description: 'the version of docker-compose command'
|
description: 'the version of docker-compose command'
|
||||||
branding:
|
branding:
|
||||||
color: blue
|
color: blue
|
||||||
|
|||||||
9996
dist/index.js
vendored
9996
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
4321
package-lock.json
generated
4321
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
13
package.json
13
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kengotoda/actions-setup-docker-compose",
|
"name": "@kengotoda/actions-setup-docker-compose",
|
||||||
"version": "1.1.0",
|
"version": "1.0.7",
|
||||||
"description": "the GitHub Action setting up docker-compose command",
|
"description": "the GitHub Action setting up docker-compose command",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"private": false,
|
"private": false,
|
||||||
@@ -30,21 +30,20 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.4.0",
|
"@actions/core": "^1.4.0",
|
||||||
"@actions/exec": "^1.1.0",
|
"@actions/exec": "^1.1.0",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^1.7.1"
|
||||||
"@octokit/action": "^4.0.10"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@semantic-release/exec": "^6.0.3",
|
"@semantic-release/exec": "^6.0.3",
|
||||||
"@semantic-release/git": "^10.0.1",
|
"@semantic-release/git": "^10.0.1",
|
||||||
"@types/node": "^18.0.0",
|
"@types/node": "^17.0.0",
|
||||||
"@typescript-eslint/parser": "^5.3.0",
|
"@typescript-eslint/parser": "^5.3.0",
|
||||||
"@vercel/ncc": "^0.36.0",
|
"@vercel/ncc": "^0.33.0",
|
||||||
"eslint": "^8.1.0",
|
"eslint": "^8.1.0",
|
||||||
"eslint-plugin-github": "^4.3.3",
|
"eslint-plugin-github": "^4.3.3",
|
||||||
"eslint-plugin-jest": "^27.0.1",
|
"eslint-plugin-jest": "^26.0.0",
|
||||||
"jest": "^27.0.6",
|
"jest": "^27.0.6",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"prettier": "2.8.1",
|
"prettier": "2.6.2",
|
||||||
"semantic-release": "^19.0.2",
|
"semantic-release": "^19.0.2",
|
||||||
"ts-jest": "^27.0.3",
|
"ts-jest": "^27.0.3",
|
||||||
"typescript": "^4.3.5"
|
"typescript": "^4.3.5"
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import {cacheFile, downloadTool} from '@actions/tool-cache'
|
import {cacheFile, downloadTool} from '@actions/tool-cache'
|
||||||
import {exec} from '@actions/exec'
|
import {exec} from '@actions/exec'
|
||||||
import * as core from '@actions/core'
|
|
||||||
import {Octokit} from '@octokit/action'
|
|
||||||
|
|
||||||
export async function runCommand(command: string): Promise<string> {
|
export async function runCommand(command: string): Promise<string> {
|
||||||
let output = ''
|
let output = ''
|
||||||
@@ -36,20 +34,7 @@ async function installOnLinux(version: string): Promise<string> {
|
|||||||
return cachedPath
|
return cachedPath
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findLatestVersion(): Promise<string> {
|
|
||||||
const octokit = new Octokit()
|
|
||||||
const response = await octokit.repos.getLatestRelease({
|
|
||||||
owner: 'docker',
|
|
||||||
repo: 'compose'
|
|
||||||
})
|
|
||||||
return response.data.tag_name
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function install(version: string): Promise<string> {
|
export async function install(version: string): Promise<string> {
|
||||||
if (version === 'latest') {
|
|
||||||
version = await findLatestVersion()
|
|
||||||
core.info(`Requested to use the latest version: ${version}`)
|
|
||||||
}
|
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return installOnLinux(version)
|
return installOnLinux(version)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {install} from './install'
|
|||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const version: string = core.getInput('version', {
|
const version: string = core.getInput('version', {
|
||||||
trimWhitespace: true
|
required: true
|
||||||
})
|
})
|
||||||
const commandPath = await install(version)
|
const commandPath = await install(version)
|
||||||
core.addPath(commandPath)
|
core.addPath(commandPath)
|
||||||
|
|||||||
Reference in New Issue
Block a user