Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add action to move major v tag #4

Merged
merged 3 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-`