-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass forward version.raw etc. (#220)
Pass forward version.raw etc. The GitHub API is not reliable anymore. So let’s ping it as little as possible. Closes #160
- Loading branch information
Showing
8 changed files
with
174 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
runs: | ||
using: composite | ||
steps: | ||
- run: pkgx --sync #FIXME bug where shebangs don’t cause an auto-sync | ||
shell: bash | ||
- uses: fregante/setup-git-user@v2 | ||
- run: git update-ref refs/remotes/origin/main HEAD | ||
working-directory: ${{ github.workspace }} | ||
shell: bash | ||
- run: | | ||
! ${GITHUB_ACTION_PATH}/../../bin/bk status | ||
shell: bash | ||
- run: cp package-mod.yml package.yml | ||
working-directory: ${{ github.workspace }}/projects/stark.com/foo | ||
shell: bash | ||
- run: | | ||
${GITHUB_ACTION_PATH}/../../bin/bk status | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: | ||
pkgx/brewkit/id | ||
description: | ||
resolve a specific version, including the raw version and tag (if available) | ||
|
||
inputs: | ||
pkg: | ||
description: eg. `pkgx.sh@1.1`. | ||
required: true | ||
token: | ||
default: ${{github.token}} | ||
required: true | ||
|
||
outputs: | ||
version: | ||
description: eg 1.2.3 | ||
value: ${{ steps.version.outputs.value }} | ||
version-raw: | ||
description: eg 1.2 | ||
value: ${{ steps.version.outputs.raw }} | ||
version-tag: | ||
description: eg v1.2 | ||
value: ${{ steps.version.outputs.tag }} | ||
pkg-json: | ||
description: json that can be fed to build/test etc. | ||
value: ${{ steps.version.outputs.json }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: prep | ||
run: | | ||
if ! pkgx --sync; then | ||
echo "::error::you must use: pkgxdev/setup before using this action" | ||
exit 1 | ||
fi | ||
shell: bash | ||
|
||
- name: fetch deno deps | ||
run: | | ||
echo "::group::fetch deno deps" | ||
pkgx deno cache ${GITHUB_ACTION_PATH}/id.ts --config=${GITHUB_ACTION_PATH}/../deno.jsonc | ||
echo "::endgroup::" | ||
shell: bash | ||
|
||
- run: ${GITHUB_ACTION_PATH}/id.ts ${{ inputs.pkg }} | ||
id: version | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ inputs.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env -S pkgx +git +gh deno run --allow-env --allow-net --allow-write --allow-run=gh --allow-read | ||
|
||
import get_config from "brewkit/config.ts" | ||
|
||
const config = await get_config(Deno.args[0]) | ||
|
||
const ghout = Deno.env.get("GITHUB_OUTPUT") | ||
|
||
Deno.writeTextFileSync(ghout!, `value=${config.pkg.version.toString()}\n`, {append: true}) | ||
if (config.pkg.version.raw) { | ||
Deno.writeTextFileSync(ghout!, `raw=${config.pkg.version.raw}\n`, {append: true}) | ||
} | ||
if (config.pkg.version.tag) { | ||
Deno.writeTextFileSync(ghout!, `tag=${config.pkg.version.tag}\n`, {append: true}) | ||
} | ||
|
||
const json = { | ||
project: config.pkg.project, | ||
version: { | ||
value: config.pkg.version.toString(), | ||
raw: config.pkg.version.raw, | ||
tag: config.pkg.version.tag | ||
} | ||
} | ||
|
||
Deno.writeTextFileSync(ghout!, `json=${JSON.stringify(json)}\n`, {append: true}) | ||
|
||
Deno.writeTextFileSync(Deno.env.get("GITHUB_ENV")!, `BREWKIT_PKGJSON=${JSON.stringify(json)}\n`, {append: true}) | ||
|
||
console.log(json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters