Skip to content

Commit

Permalink
feat(gh-actions): add support for GitHub Actions (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrqr authored Feb 1, 2022
1 parent 27e9eac commit 0ce9865
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,30 @@ bump libs/xyz from 0.0.0 to 0.1.0
# creates a tag `libs/xyz/0.1.0`
```

## Usage in GitHub Actions

The following example shows a workflow using git-semver in GitHub Actions:

```yaml
name: Bump

jobs:
bump:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: carlsberg/git-semver@v0.5.0
with:
script: |
echo "Latest Version: $(git semver latest)"
echo "Next Version: $(git semver next)"
git semver bump -u ${{ github.actor }} -P ${{ github.token }}
```
## License
This project is released under the [MIT License](LICENSE).
Expand Down
32 changes: 32 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Git SemVer
description: Installs and runs git-semver

inputs:
script:
description: Shell script to run
required: true

runs:
using: composite
steps:
- id: version
run: |
v="${{ github.action_ref }}"
v=$(echo "${v:1}")
echo "::set-output name=version::$v"
shell: bash

- run: |
v="${{ steps.version.outputs.version }}"
url="https://github.com/carlsberg/git-semver/releases/download/v$v/git-semver_$v_Linux_x86_64.tar.gz"
curl -L "$url" >> git-semver.tar.gz
tar -xvzf git-semver.tar.gz
mkdir $HOME/.local/bin && mv git-semver $HOME/.local/bin
echo $HOME/.local/bin >> $GITHUB_PATH
shell: bash
- run: |
echo '${{ inputs.runs }}' >> script.sh
chmod +x script.sh
./script.sh
shell: bash

0 comments on commit 0ce9865

Please sign in to comment.