-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gh-actions): add support for GitHub Actions (#37)
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 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 |
---|---|---|
|
@@ -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/[email protected] | ||
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). | ||
|
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,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 |