Skip to content

Commit

Permalink
feat: Default docker-compose version to latest (#643)
Browse files Browse the repository at this point in the history
* test: add expected behavior as a test case

Signed-off-by: Kengo TODA <skypencil@gmail.com>

* implement the necessary feature

Signed-off-by: Kengo TODA <skypencil@gmail.com>

* add a missing return type

Signed-off-by: Kengo TODA <skypencil@gmail.com>

* ci: try to run action without GITHUB_TOKEN env var

Signed-off-by: Kengo TODA <skypencil@gmail.com>

* input version is not required

Signed-off-by: Kengo TODA <skypencil@gmail.com>

* update the distributed package

Signed-off-by: Kengo TODA <skypencil@gmail.com>

* fix eslint warning

Signed-off-by: Kengo TODA <skypencil@gmail.com>

* provide GITHUB_TOKEN to create Octokit

Signed-off-by: Kengo TODA <skypencil@gmail.com>

* docs: update README.md

Signed-off-by: Kengo TODA <skypencil@gmail.com>

* docs: update README.md

Signed-off-by: Kengo TODA <skypencil@gmail.com>

* docs: update README.md

Signed-off-by: Kengo TODA <skypencil@gmail.com>

* docs: update README.md

Signed-off-by: Kengo TODA <skypencil@gmail.com>

* update distributions

Signed-off-by: Kengo TODA <skypencil@gmail.com>

Signed-off-by: Kengo TODA <skypencil@gmail.com>
  • Loading branch information
KengoTODA committed Dec 25, 2022
1 parent 83838f3 commit c61c6f5
Show file tree
Hide file tree
Showing 11 changed files with 8,959 additions and 242 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"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",
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
- run: |
npm ci
npm run all
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run semantic-release
run: |
npx semantic-release
Expand All @@ -29,6 +31,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@v3
- uses: ./
Expand All @@ -40,6 +44,10 @@ jobs:
- uses: ./
with:
version: 'v2.4.1'
- uses: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

actionlint:
runs-on: ubuntu-latest
if: github.event.pull_request
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@ Add a step to your workflow like below:
steps:
- uses: KengoTODA/actions-setup-docker-compose@main
with:
version: '1.29.2'
version: '2.14.2' # the full version of `docker-compose` command
```

The `version` parameter is required, specify the full version of `docker-compose` command.
Or you can omit it then 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 }}
```

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.
6 changes: 6 additions & 0 deletions __tests__/install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,10 @@ describe('install', () => {
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()
})
})
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'Automate download and set up process for docker-compose command'
author: 'Kengo TODA <skypencil@gmail.com>'
inputs:
version:
required: true
default: 'latest'
description: 'the version of docker-compose command'
branding:
color: blue
Expand Down

0 comments on commit c61c6f5

Please sign in to comment.