Skip to content

Instantly share code, notes, and snippets.

@dhet
Created May 24, 2020 20:18
Show Gist options
  • 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/[email protected]
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/[email protected]
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