Skip to content

Commit

Permalink
feat: add a setup action (#74)
Browse files Browse the repository at this point in the history
* add an action

* /setup

* checkout

* provide github token

* $dir

* export path

* get the current version
  • Loading branch information
justinmchase authored Aug 2, 2024
1 parent a5d09b4 commit 7fb6cb3
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ on:
- kind: regexp
file: Dockerfile
pattern: '(?<=VERSION=).*(?=; \\)'
- kind: regexp
file: action.yml
pattern: '(?<=default: ).*'
17 changes: 12 additions & 5 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: [ ubuntu-latest ]

steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
Expand All @@ -21,21 +21,21 @@ jobs:
- run: deno fmt --check
- run: deno lint
- run: deno task test

- id: parse_version
name: Parse the Version
run: deno run -A main.ts parse

- name: Print the Version
run: |
cat >> $GITHUB_STEP_SUMMARY<<EOF
# Version
\`\`\`
${{ steps.parse_version.outputs.version }}
\`\`\`
| part | value |
| ---------- | --- |
| version | \`${{ steps.parse_version.outputs.version }}\` |
Expand All @@ -45,3 +45,10 @@ jobs:
| prerelease | \`${{ steps.parse_version.outputs.prerelease || ' ' }}\` |
| build | \`${{ steps.parse_version.outputs.build || ' ' }}\` |
EOF
action:
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- uses: ./setup
- run: semver get
29 changes: 29 additions & 0 deletions setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: semver-cli-setup
description: Optum Semver CLI
branding:
icon: activity
color: orange
inputs:
version:
description: Version
default: 0.8.11
token:
description: GitHub Token
required: false

runs:
using: "composite"
steps:
- name: Install Semver CLI
shell: bash
run: |
VERSION='${{ inputs.version}}'
DIR=$HOME/.semver-cli/.bin
mkdir -p $DIR
gh release --repo https://github.com/optum/semver-cli download $VERSION -p semver.x86_64-unknown-linux-gnu.tar.gz --dir $DIR --clobber
tar -xzf $DIR/semver.x86_64-unknown-linux-gnu.tar.gz -C $DIR
echo "$DIR" >> $GITHUB_PATH
env:
GH_TOKEN: ${{ inputs.token || github.token }}

0 comments on commit 7fb6cb3

Please sign in to comment.