Skip to content

Create Version Tag

Create Version Tag #1

Workflow file for this run

name: Create Version Tag
on:
workflow_dispatch:
inputs:
tag:
type: string
description: Tag Version (exclude prefix; e.g. 1.2.3)
required: true
jobs:
tag-changelog:
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Fail on tags
run: exit 1
if: ${{ !startsWith(github.ref, 'refs/heads/') }}
- name: Validate Tag Input
id: input
run: |
vtag=${{ github.event.inputs.tag }}
echo "tag=${vtag//v}" >> $GITHUB_OUTPUT
- uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a
- uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5
with:
fetch-depth: 0 # fetch all history for all branches and tags
# https://medium.com/prompt/trigger-another-github-workflow-without-using-a-personal-access-token-f594c21373ef
ssh-key: "${{ secrets.COMMIT_KEY }}"
- name: Create Git Tag
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
git config commit.gpgsign false
git tag v${{ steps.input.outputs.tag }} -m "Release v${{ steps.input.outputs.tag }}"
git push --tags origin
# - name: Setup Tools
# uses: ./.github/actions/setup-tools
# - name: Setup NPM Packages
# uses: ./.github/actions/setup-npm
# - name: Create a tag and update changelog
# run: |
# git config user.name "$GITHUB_ACTOR"
# git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
# git config commit.gpgsign false
# branch=changelog/${{ steps.input.outputs.tag }}
# git checkout -b "$branch"
# git push --set-upstream origin "$branch"
# echo "git status - 0"
# git status
# echo "git status - 1"
# git reset --hard
# ./node_modules/.bin/release-it ${{ steps.input.outputs.tag }} --only-version
# - name: Set output variables
# id: vars
# run: |
# pr_title="chore: release candidate v${{ steps.input.outputs.tag }}"
# pr_body=$(git tag -l --format='%(contents)' v${{ steps.input.outputs.tag }})
# echo "pr_title=$pr_title" >> $GITHUB_OUTPUT
# echo "base=$GITHUB_REF_NAME" >> $GITHUB_OUTPUT
# # See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
# EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
# echo "pr_body<<$EOF" >> "$GITHUB_OUTPUT"
# echo "$pr_body" >> $GITHUB_OUTPUT
# echo "$EOF" >> "$GITHUB_OUTPUT"
# - name: Create Pull Request
# uses: actions/github-script@6f00a0b667f9463337970371ccda9072ee86fb27
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# script: |
# const { repo, owner } = context.repo;
# const result = await github.rest.pulls.create({
# owner,
# repo,
# head: 'changelog/${{ steps.input.outputs.tag }}',
# base: '${{ steps.vars.outputs.base }}',
# title: '${{ steps.vars.outputs.pr_title }}',
# body: `### Commits
# ${{ steps.vars.outputs.pr_body }}
# ### GitHub Action
# - [Build and deploy Apps in Test Environment](https://github.com/strdss/actions/workflows/deploy-test.yml)
# `,
# });
# github.rest.issues.addLabels({
# owner,
# repo,
# issue_number: result.data.number,
# labels: ['changelog', 'v${{ steps.input.outputs.tag }}']
# });
# # github.rest.pulls.merge({
# # owner,
# # repo,
# # pull_number: result.data.number,
# # merge_method: 'merge'
# # });
# - name: Delete Changelog Branch
# run: |
# git push origin -d changelog/${{ steps.input.outputs.tag }}