Skip to content

Commit

Permalink
feat: add binaries to path
Browse files Browse the repository at this point in the history
  • Loading branch information
oknozor committed Nov 22, 2021
1 parent d997156 commit 4c4915c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This action uses [cocogitto](https://github.com/oknozor/cocogitto) to check
your repository is [conventional commit](https://conventionalcommits.org/) and perform auto-release.

## Requirement
-

1. Before running this action you need to call checkout action with `fetch-depth: 0`. This is mandatory, otherwise not all commit
will be fetched and cocogitto will fail to execute (see [actions/checkout](https://github.com/actions/checkout#checkout-v2) for more info).

Expand Down
16 changes: 12 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,20 @@ outputs:
runs:
using: "composite"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: echo Installing cocogitto
shell: bash

- id: install
run: ${{ github.action_path }}/install.sh
shell: bash

- run: echo Running cog check
- run: echo Running cocogitto
shell: bash

- id: add-to-path
shell: sh
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- id: cog
run: |
Expand Down
17 changes: 3 additions & 14 deletions cog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,18 @@

set -a

VERSION=3.0.0
TAR="cocogitto-$VERSION-x86_64-unknown-linux-musl.tar.gz"
CHECK=$1
LATEST_TAG_ONLY=$2
RELEASE=$3
GIT_USER=$4
GIT_USER_EMAIL=$5
CUR_DIR=$(pwd)
BIN_DIR=/home/runner/work/bin


echo "Setting git user : $GIT_USER"
git config --global user.name "$GIT_USER"

echo "Settings git user email $GIT_USER_EMAIL"
git config --global user.email "$GIT_USER_EMAIL"

mkdir -p "$BIN_DIR"
cd "$BIN_DIR" || exit
curl -OL https://github.com/oknozor/cocogitto/releases/download/"$VERSION"/"$TAR"
tar xfz $TAR

cd "$CUR_DIR" || exit

if [ "$CHECK" = "true" ]; then
if [ "$LATEST_TAG_ONLY" = "true" ]; then
Expand All @@ -34,15 +23,15 @@ if [ "$CHECK" = "true" ]; then
message="No tag found checking history from first commit"
fi
echo "$message"
"$BIN_DIR"/./cog check --from-latest-tag || exit 1
cog check --from-latest-tag || exit 1
else
echo "Checking all commits"
"$BIN_DIR"/./cog check || exit 1
cog check || exit 1
fi
fi

if [ "$RELEASE" = "true" ]; then
"$BIN_DIR"/./cog bump --auto || exit 1
cog bump --auto || exit 1
VERSION="$(git describe --tags "$(git rev-list --tags --max-count=1)")"
echo ::set-output name=version::"$VERSION"
fi
12 changes: 12 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

CUR_DIR=$(pwd)
VERSION=3.0.0
TAR="cocogitto-$VERSION-x86_64-unknown-linux-musl.tar.gz"
BIN_DIR="$HOME/.local/bin"

mkdir -p "$BIN_DIR"
cd "$BIN_DIR" || exit
curl -OL https://github.com/oknozor/cocogitto/releases/download/"$VERSION"/"$TAR"
tar xfz $TAR
cd "$CUR_DIR" || exit

0 comments on commit 4c4915c

Please sign in to comment.