Skip to content

Commit

Permalink
add action to move major v tag (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jetersen authored Jun 13, 2022
1 parent bab1522 commit 1b4d109
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/self-update-major-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
required: false
description: The tag to move major version tag to
default: ""

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: version
id: version
env:
INPUT_TAG: ${{ inputs.tag }}
run: |
if [[ "${INPUT_TAG}" =~ ^v[0-9]+.[0-9]+.[0-9]+$ ]]; then
tag="${INPUT_TAG}"
fi
if [[ ! -z "${GITHUB_REF}" ]] && [[ "${GITHUB_REF}" =~ ^refs/tags/v[0-9]+.[0-9]+.[0-9]+$ ]]; then
tag=${GITHUB_REF/refs\/tags\//}
fi
if [[ -z "${tag}" ]]; then
echo "No tag found"
exit 1
fi
version=${tag#v}
major=${version%%.*}
echo "::set-output name=tag::${tag}"
echo "::set-output name=version::${version}"
echo "::set-output name=major::${major}"
- name: force update major tag
run: |
git tag v${{ steps.version.outputs.major }} ${{ steps.version.outputs.tag }} -f
git push origin refs/tags/v${{ steps.version.outputs.major }} -f
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# github-reusable-workflows

Repository for reusable workflows

## Other workflows

We do host some non reusable workflows that is meant to be consumed by repository as in any workflows files starting with `self-`

0 comments on commit 1b4d109

Please sign in to comment.