Skip to content

Commit

Permalink
refactor: rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
josegonzalez committed May 16, 2024
1 parent 19914a1 commit a179ad8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/bump-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ name: "bump-version"
on:
workflow_dispatch:
inputs:
release_type:
description: "Release type"
bump_type:
description: "Bump type"
default: "patch"
required: true
type: choice
Expand Down Expand Up @@ -58,16 +58,16 @@ jobs:
- name: Compute Next Tag
id: next-tag
run: |
git_next_tag="$(docker run --rm -e GITHUB_VERSION_INPUT -e GITHUB_VERSION_BUMP ghcr.io/${{ github.repository }}:${{ github.sha }})"
git_next_tag="$(docker run --rm -e SEMVER_GENERATOR_INPUT -e SEMVER_GENERATOR_BUMP ghcr.io/${{ github.repository }}:${{ github.sha }})"
if [[ -z "$git_next_tag" ]]; then
echo "Failed to compute next tag"
docker run --rm -e GITHUB_VERSION_INPUT -e GITHUB_VERSION_BUMP ghcr.io/${{ github.repository }}:${{ github.sha }}
docker run --rm -e SEMVER_GENERATOR_INPUT -e SEMVER_GENERATOR_BUMP ghcr.io/${{ github.repository }}:${{ github.sha }}
exit 1
fi
echo "GIT_NEXT_TAG=$git_next_tag" >>"$GITHUB_OUTPUT"
env:
GITHUB_VERSION_INPUT: ${{ steps.latest-tag.outputs.GIT_LATEST_TAG }}
GITHUB_VERSION_BUMP: ${{ github.event.inputs.release_type }}
SEMVER_GENERATOR_INPUT: ${{ steps.latest-tag.outputs.GIT_LATEST_TAG }}
SEMVER_GENERATOR_BUMP: ${{ github.event.inputs.bump_type }}

- name: Create and Push Tag
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ docker build --progress plain -t semver .
docker run --rm semver --input 0.1.2 --bump patch

# run it with environment variables
docker run --rm -e GITHUB_VERSION_INPUT=0.1.2 -e GITHUB_VERSION_BUMP=patch semver
docker run --rm -e SEMVER_GENERATOR_INPUT=0.1.2 -e SEMVER_GENERATOR_BUMP=patch semver
```
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ runs:
image: "Dockerfile"
entrypoint: "/usr/local/bin/entrypoint"
env:
GITHUB_VERSION_BUMP: ${{ inputs.bump }}
GITHUB_VERSION_INPUT: ${{ inputs.input }}
SEMVER_GENERATOR_BUMP: ${{ inputs.bump }}
SEMVER_GENERATOR_INPUT: ${{ inputs.input }}
4 changes: 2 additions & 2 deletions entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ set -e

main() {
declare ARGS=("$@")
if [[ -n "$GITHUB_VERSION_INPUT" ]] && [[ -n "$GITHUB_VERSION_BUMP" ]]; then
ARGS=("--input" "$GITHUB_VERSION_INPUT" "--bump" "$GITHUB_VERSION_BUMP")
if [[ -n "$SEMVER_GENERATOR_INPUT" ]] && [[ -n "$SEMVER_GENERATOR_BUMP" ]]; then
ARGS=("--input" "$SEMVER_GENERATOR_INPUT" "--bump" "$SEMVER_GENERATOR_BUMP")
fi

if [ ${#ARGS[@]} -eq 0 ]; then
Expand Down

0 comments on commit a179ad8

Please sign in to comment.