Skip to content

Commit

Permalink
symlink is needed for tea/cli (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl authored Sep 29, 2022
1 parent 19092c2 commit 42d973b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[`install.sh`](./install.sh) is delivered when you `curl tea.xyz`.


# GitHub Action 0.5.3
# GitHub Action 0.5.4

This repository also provides the `tea` GitHub Action.

Expand Down
12 changes: 10 additions & 2 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const fs = require('fs')
const os = require("os")

async function go() {
process.stdout.write("installing tea…\n")
process.stderr.write("determining latest tea version…\n")

const PREFIX = process.env['INPUT_PREFIX'] || `${os.homedir()}/opt`
const TEA_DIR = (() => {
Expand Down Expand Up @@ -49,7 +49,7 @@ async function go() {
}).on('error', reject)
})

process.stdout.write(`fetching tea.xyz@${v}\n`)
process.stderr.write(`fetching tea.xyz@${v}\n`)

fs.mkdirSync(PREFIX, { recursive: true })

Expand All @@ -66,6 +66,12 @@ async function go() {
throw new Error(`tar: ${exitcode}`)
}

const oldwd = process.cwd()
process.chdir(`${PREFIX}/tea.xyz`)
fs.symlinkSync(`v${v}`, `v*`, 'dir')
fs.symlinkSync(`v${v}`, `v0`, 'dir') //FIXME
process.chdir(oldwd)

const GITHUB_PATH = process.env['GITHUB_PATH']
const bindir = `${PREFIX}/tea.xyz/v${v}/bin`
fs.appendFileSync(GITHUB_PATH, `${bindir}\n`, {encoding: 'utf8'})
Expand Down Expand Up @@ -103,6 +109,8 @@ async function go() {
}

process.stdout.write(`::set-output name=prefix::${PREFIX}`)

process.stderr.write(`installed ${PREFIX}/tea.xyz/v${v}\n`)
}

go().catch(err => {
Expand Down

0 comments on commit 42d973b

Please sign in to comment.