Compare commits
1 Commits
renovate/m
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b60e4772d |
@@ -11,7 +11,6 @@
|
||||
"eslint-comments/no-use": "off",
|
||||
"import/no-namespace": "off",
|
||||
"no-unused-vars": "off",
|
||||
"i18n-text/no-en": "off",
|
||||
"@typescript-eslint/no-unused-vars": "error",
|
||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
||||
"@typescript-eslint/no-require-imports": "error",
|
||||
|
||||
6
.github/auto-merge.yml
vendored
Normal file
6
.github/auto-merge.yml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
minApprovals:
|
||||
NONE: 0
|
||||
requiredLabels:
|
||||
- dependencies
|
||||
updateBranch: true
|
||||
mergeMethod: rebase
|
||||
10
.github/dependabot.yml
vendored
Normal file
10
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
commit-message:
|
||||
prefix: fix
|
||||
prefix-development: chore
|
||||
include: scope
|
||||
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@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 }}
|
||||
28
.github/workflows/test.yml
vendored
28
.github/workflows/test.yml
vendored
@@ -10,19 +10,17 @@ jobs:
|
||||
build: # make sure build/ci work properly
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
# Make sure the release step uses its own credentials.
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v3
|
||||
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
|
||||
@@ -31,10 +29,8 @@ jobs:
|
||||
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: actions/checkout@v3
|
||||
- uses: ./
|
||||
with:
|
||||
version: '1.26.2'
|
||||
@@ -44,21 +40,3 @@ jobs:
|
||||
- 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
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,7 +1,7 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2021-2024 Kengo TODA
|
||||
Copyright (c) 2021 Kengo TODA
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
20
README.md
20
README.md
@@ -4,29 +4,15 @@
|
||||
|
||||
This action downloads the `docker-compose` command and add it to the `PATH` for following executions. It supports the Linux environment only.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> The `docker-compose` command is now deprecated, consider to use the `docker compose` sub command instead. Refer to [Docker official blog](https://www.docker.com/blog/announcing-compose-v2-general-availability/) for detail.
|
||||
|
||||
## How to use
|
||||
|
||||
Add a step to your workflow like below:
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: KengoTODA/actions-setup-docker-compose@v1
|
||||
with:
|
||||
version: '2.14.2' # the full version of `docker-compose` command
|
||||
```
|
||||
|
||||
Or set a `GITHUB_TOKEN` environment variable, to use the latest released version:
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: KengoTODA/actions-setup-docker-compose@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
version: '1.29.2'
|
||||
```
|
||||
|
||||
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.
|
||||
The `version` parameter is required, specify the full version of `docker-compose` command.
|
||||
|
||||
@@ -1,27 +1,23 @@
|
||||
import {install, runCommand} from '../src/install'
|
||||
import * as core from '@actions/core'
|
||||
|
||||
import {describe, expect, it, test} from '@jest/globals'
|
||||
import {expect, test} from '@jest/globals'
|
||||
|
||||
describe('runCommand', () => {
|
||||
it('runs a command and returns its stdout', async () => {
|
||||
const result = await runCommand('echo foo bar')
|
||||
expect(result).toBe('foo bar')
|
||||
})
|
||||
test('runCommand', async () => {
|
||||
const result = await runCommand('echo foo bar')
|
||||
expect(result).toBe('foo bar')
|
||||
})
|
||||
|
||||
describe('install', () => {
|
||||
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)
|
||||
core.addPath(commandPath)
|
||||
const result = await runCommand('docker-compose version')
|
||||
expect(result).toContain(version)
|
||||
})
|
||||
it('can install latest version', async () => {
|
||||
const commandPath = await install('latest')
|
||||
core.addPath(commandPath)
|
||||
const result = await runCommand('docker-compose version')
|
||||
expect(result).not.toBeFalsy()
|
||||
})
|
||||
async function testVersion(version: string) {
|
||||
const commandPath = await install(version)
|
||||
core.addPath(commandPath)
|
||||
const result = await runCommand('docker-compose version')
|
||||
expect(result).toContain(version)
|
||||
}
|
||||
|
||||
test('Install the right version', async () => {
|
||||
await testVersion('1.29.1')
|
||||
await testVersion('1.29.2')
|
||||
await testVersion('2.2.3')
|
||||
await testVersion('v2.2.3')
|
||||
})
|
||||
|
||||
@@ -3,11 +3,11 @@ description: 'Automate download and set up process for docker-compose command'
|
||||
author: 'Kengo TODA <skypencil@gmail.com>'
|
||||
inputs:
|
||||
version:
|
||||
default: 'latest'
|
||||
required: true
|
||||
description: 'the version of docker-compose command'
|
||||
branding:
|
||||
color: blue
|
||||
icon: play
|
||||
runs:
|
||||
using: 'node20'
|
||||
using: 'node16'
|
||||
main: 'dist/index.js'
|
||||
|
||||
31573
dist/index.js
vendored
31573
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
18789
package-lock.json
generated
18789
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@kengotoda/actions-setup-docker-compose",
|
||||
"version": "1.2.2",
|
||||
"version": "1.0.7",
|
||||
"description": "the GitHub Action setting up docker-compose command",
|
||||
"main": "lib/main.js",
|
||||
"private": false,
|
||||
@@ -28,26 +28,25 @@
|
||||
"author": "Kengo TODA <skypencil@gmail.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@octokit/action": "^6.0.7"
|
||||
"@actions/core": "^1.4.0",
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/tool-cache": "^1.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@semantic-release/exec": "^6.0.3",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@types/node": "^20.0.0",
|
||||
"@typescript-eslint/parser": "^7.0.0",
|
||||
"@vercel/ncc": "^0.38.0",
|
||||
"eslint": "^9.0.0",
|
||||
"eslint-plugin-github": "^4.10.2",
|
||||
"eslint-plugin-jest": "^28.0.0",
|
||||
"jest": "^29.0.0",
|
||||
"@types/node": "^17.0.0",
|
||||
"@typescript-eslint/parser": "^5.3.0",
|
||||
"@vercel/ncc": "^0.33.0",
|
||||
"eslint": "^8.1.0",
|
||||
"eslint-plugin-github": "^4.3.3",
|
||||
"eslint-plugin-jest": "^26.0.0",
|
||||
"jest": "^27.0.6",
|
||||
"js-yaml": "^4.1.0",
|
||||
"prettier": "3.2.5",
|
||||
"semantic-release": "^23.0.0",
|
||||
"ts-jest": "^29.0.0",
|
||||
"typescript": "^5.0.0"
|
||||
"prettier": "2.6.2",
|
||||
"semantic-release": "^19.0.2",
|
||||
"ts-jest": "^27.0.3",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"release": {
|
||||
"branches": "main",
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"packageRules": [
|
||||
{
|
||||
"matchDepTypes": ["devDependencies"],
|
||||
"matchUpdateTypes": ["minor", "patch"],
|
||||
"matchCurrentVersion": "!/^0/",
|
||||
"automerge": true
|
||||
}
|
||||
],
|
||||
"extends": [
|
||||
"config:recommended"
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
import {cacheFile, downloadTool} from '@actions/tool-cache'
|
||||
import {exec} from '@actions/exec'
|
||||
import * as core from '@actions/core'
|
||||
import {Octokit} from '@octokit/action'
|
||||
|
||||
export async function runCommand(command: string): Promise<string> {
|
||||
let output = ''
|
||||
@@ -36,20 +34,7 @@ async function installOnLinux(version: string): Promise<string> {
|
||||
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> {
|
||||
if (version === 'latest') {
|
||||
version = await findLatestVersion()
|
||||
core.info(`Requested to use the latest version: ${version}`)
|
||||
}
|
||||
switch (process.platform) {
|
||||
case 'linux':
|
||||
return installOnLinux(version)
|
||||
|
||||
@@ -4,7 +4,7 @@ import {install} from './install'
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
const version: string = core.getInput('version', {
|
||||
trimWhitespace: true
|
||||
required: true
|
||||
})
|
||||
const commandPath = await install(version)
|
||||
core.addPath(commandPath)
|
||||
|
||||
Reference in New Issue
Block a user