Skip to content

Commit

Permalink
Merge pull request #8 from getindata/feat/partial-semver
Browse files Browse the repository at this point in the history
feat: Add workflow for pushing partial semver tags
  • Loading branch information
kacpermuda authored Oct 19, 2023
2 parents 6e2da02 + 2158e49 commit 57e8c63
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/_self-gh-create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ on:
jobs:
release:
uses: getindata/github-workflows/.github/workflows/gh-create-release.yml@main

partial_semver_tags:
needs: release
uses: getindata/github-workflows/.github/workflows/gh-partial-semver-tags.yml@main
2 changes: 2 additions & 0 deletions .github/workflows/gh-create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
- name: Get latest tag
id: latest-tag
uses: actions-ecosystem/[email protected]
with:
semver_only: true
if: ${{ steps.release-label.outputs.level != null }}

- name: Bump semantic version
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/gh-partial-semver-tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Add partial semver tags

permissions:
contents: write

on:
workflow_call:

jobs:
get-semver:
runs-on: ubuntu-latest
outputs:
major: ${{ steps.semver_parser.outputs.major }}
minor: ${{ steps.semver_parser.outputs.minor }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100

- name: Get latest tag
id: latest_tag
uses: actions-ecosystem/[email protected]
with:
semver_only: true

- name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: ${{ steps.latest_tag.outputs.tag }}
version_extractor_regex: '^v(.*)$'

partial-semver-tags:
needs: get-semver
runs-on: ubuntu-latest
strategy:
matrix:
tags: [
"v${{ needs.get-semver.outputs.major }}",
"v${{ needs.get-semver.outputs.major }}.${{ needs.get-semver.outputs.minor }}"
]

steps:
- name: Tag Repo
uses: richardsimko/update-tag@v1
with:
tag_name: ${{ matrix.tags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 57e8c63

Please sign in to comment.