Skip to content

Commit

Permalink
Merge pull request #424 from scala-steward-org/feature/clean-mill
Browse files Browse the repository at this point in the history
Ensure `mill` binary is cleaned-up
  • Loading branch information
alejandrohdezma authored Dec 3, 2022
2 parents a5133c2 + 805c38b commit 1ecf4d8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/mill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import * as io from '@actions/io'
import * as tc from '@actions/tool-cache'
import * as exec from '@actions/exec'

/**
* Installs `Mill` and add its executable to the `PATH`.
*
* Throws error if the installation fails.
*/
export async function install(): Promise<string> {
try {
const millVersion = core.getInput('mill-version') || '0.10.9'
Expand Down Expand Up @@ -60,3 +65,10 @@ export async function install(): Promise<string> {
core.info(`✓ Mill installed, version: ${version.trim()}`)
return version
}

/**
* Removes Mill binary
*/
export async function remove(): Promise<void> {
await io.rmRF(path.join(path.join(os.homedir(), 'bin'), 'mill'))
}
3 changes: 3 additions & 0 deletions src/post.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as core from '@actions/core'
import * as workspace from './workspace'
import * as coursier from './coursier'
import * as mill from './mill'

/**
* Performs a cleanup of all the artifacts/folders created by this action.
Expand All @@ -11,6 +12,8 @@ async function post(): Promise<void> {
core.info('🗑 Scala Steward\'s workspace removed')
await coursier.remove()
core.info('🗑 Coursier binary removed')
await mill.remove()
core.info('🗑 Mill binary removed')
} catch (error: unknown) {
core.warning((error as Error).message)
}
Expand Down

0 comments on commit 1ecf4d8

Please sign in to comment.