Skip to content

cloudposse-github-actions/create-branch-from-tag

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Create Branch from a Specific Tag

Latest ReleaseSlack Community

This action creates a new branch from a specific tag.

Introduction

This action creates a new branch from a specific tag.

This is a fork of satya-500's create a branch from a tag action

Usage

create branch from tag

- name: creating rc branch
  uses: cloudposse-github-actions/[email protected]
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    branch: release
    tag: tags/v0.0.7

create branch from specific ref (branch)

- name: creating rc branch
  uses: cloudposse-github-actions/[email protected]
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    branch: release
    tag: test

Full Job Example (Workflow Dispatch as a shared reusable workflow)

on:
  workflow_call:
    inputs:
      runs-on:
        description: "The runner labels on which jobs should run on"
        required: false
        type: string
        default: '["self-hosted"]'
      organization:
        description: "Repository owner organization (e.g. 'acme' for repo acme/example)"
        required: true
        type: string
      repository:
        description: "Repository name (e.g. 'example' for repo acme/example)"
        required: true
        type: string
      tag:
        description: "The semantic version tag of the release (e.g. 'v1.1.0')"
        required: true
        type: string
    outputs:
      branch-name:
        description: "Branch name"
        value: ${{ jobs.create-branch.outputs.branch-name }}

permissions:
  id-token: write
  contents: write 

jobs:
  create-branch:
    name: build
    runs-on: ${{ fromJSON(inputs.runs-on) }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4
  
      - name: Parse Semver
        id: parse-semver
        uses: booxmedialtd/ws-action-parse-semver@v1
        with:
          input_string: ${{ inputs.tag }}

      - name: Create Release Branch 
        uses: cloudposse-github-actions/create-branch-from-tag@main
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          # The following can easily just be 'release/${{ inputs.tag }}', however it is left as is
          # in case the tag needs to be manipulated. For example:
          # 'release/${{ steps.parse-semver.outputs.major }}.${{ steps.parse-semver.outputs.minor }}.x'
          branch: release/${{ steps.parse-semver.outputs.fullversion }}
          from: tags/${{ inputs.tag }}

Inputs

Name Description Default Required
branch The branch to create release false
from Provide the tag number ex:- v0.0.7 or branch name i.e develop N/A true

Related Projects

Check out these related projects.

✨ Contributing

This project is under active development, and we encourage contributions from our community.

For πŸ› bug reports & feature requests, please use the issue tracker.

In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

  1. Review our Code of Conduct and Contributor Guidelines.
  2. Fork the repo on GitHub
  3. Clone the project to your own machine
  4. Commit changes to your own branch
  5. Push your work back up to your fork
  6. Submit a Pull Request so that we can review your changes

NOTE: Be sure to merge the latest changes from "upstream" before making a pull request!

🌎 Slack Community

Join our Open Source Community on Slack. It's FREE for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally sweet infrastructure.

πŸ“° Newsletter

Sign up for our newsletter and join 3,000+ DevOps engineers, CTOs, and founders who get insider access to the latest DevOps trends, so you can always stay in the know. Dropped straight into your Inbox every week β€” and usually a 5-minute read.

πŸ“† Office Hours

Join us every Wednesday via Zoom for your weekly dose of insider DevOps trends, AWS news and Terraform insights, all sourced from our SweetOps community, plus a live Q&A that you can’t find anywhere else. It's FREE for everyone!

License

License

Preamble to the Apache License, Version 2.0

Complete license is available in the LICENSE file.

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

Trademarks

All other trademarks referenced herein are the property of their respective owners.


Copyright Β© 2017-2025 Cloud Posse, LLC

README footer

Beacon

About

Creates a branch from a tag. Useful for release branches!

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 2

  •  
  •