Skip to content

Instantly share code, notes, and snippets.

@dhet
Created May 24, 2020 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhet/1d9805c9e5d233620b7a2307f1ecf21a to your computer and use it in GitHub Desktop.
Save dhet/1d9805c9e5d233620b7a2307f1ecf21a to your computer and use it in GitHub Desktop.
Github action for tagging a repo with the project version pulled from SBT (only create tag when the SBT version differs from the previous tag)
name: Create git tag from SBT
on:
push:
branch: master
jobs:
Tag:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get most recent tag
id: last_tag
uses: WyriHaximus/github-action-get-previous-tag@0.2.0
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Setup Scala
uses: olafurpg/setup-scala@v5
- name: Get version from SBT file
id: sbt_version
run: echo "::set-output name=version::$(sbt version | tail -n 1 | awk '{print $2}')"
- name: Create tag
if: ${{ steps.sbt_version.outputs.version != steps.last_tag.outputs.tag }}
uses: richardsimko/update-tag@v1.0.3
with:
tag_name: ${{ steps.sbt_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment