55#
66
77# Name of this project
8- name : github-action-typescript-template
8+ name : Create Branch from a Specific Tag
99
1010# Tags of this project
1111tags :
1212 - github-action
1313 - typescript
14- - template
1514
1615# Logo for this project
1716# logo: docs/logo.png
@@ -20,39 +19,113 @@ tags:
2019license : " APACHE2"
2120
2221# Canonical GitHub repo
23- github_repo : cloudposse/ github-action-typescript-template
22+ github_repo : cloudposse- github-actions/create-branch-from-tag
2423
2524# Badges to display
2625badges :
2726 - name : " Latest Release"
28- image : " https://img.shields.io/github/release/cloudposse/ github-action-typescript-template .svg"
29- url : " https://github.com/cloudposse/ github-action-typescript-template /releases/latest"
27+ image : " https://img.shields.io/github/release/cloudposse- github-actions/create-branch-from-tag .svg"
28+ url : " https://github.com/cloudposse- github-actions/create-branch-from-tag /releases/latest"
3029 - name : " Slack Community"
3130 image : " https://slack.cloudposse.com/badge.svg"
3231 url : " https://slack.cloudposse.com"
3332
3433related : []
3534
3635# Short description of this project
37- description : Template repo for GitHub Actions written in TypeScript
36+ description : This action creates a new branch from a specific tag.
3837
3938introduction : |-
40- This repo is a template for GitHub Actions written in TypeScript.
41- references :
42- - name : " github-actions-workflows"
43- description : " Reusable workflows for different types of projects"
44- url : " https://github.com/cloudposse/github-actions-workflows"
45- - name : " example-github-action-release-workflow"
46- description : " Example application with complicated release workflow"
47- url : " https://github.com/cloudposse/example-github-action-release-workflow"
39+ This action creates a new branch from a specific tag.
40+
41+ This is a fork of [satya-500's create a branch from a tag action](https://github.com/satya-500/create-branch-from-tag)
42+
43+ # references:
44+ # - name: "github-actions-workflows"
45+ # description: "Reusable workflows for different types of projects"
46+ # url: "https://github.com/cloudposse/github-actions-workflows"
47+ # - name: "example-github-action-release-workflow"
48+ # description: "Example application with complicated release workflow"
49+ # url: "https://github.com/cloudposse/example-github-action-release-workflow"
4850
4951# How to use this project
5052usage : |
51- Use this repository as a template in your own GitHub Action project to get started.
5253
53- include :
54+ create branch from tag
55+ ```yaml
56+ - name: creating rc branch
57+ uses: cloudposse-github-actions/[email protected] 58+ env:
59+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+ with:
61+ branch: release
62+ tag: tags/v0.0.7
63+ ```
64+
65+ create branch from specific ref (branch)
66+ ```yaml
67+ - name: creating rc branch
68+ uses: cloudposse-github-actions/[email protected] 69+ env:
70+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+ with:
72+ branch: release
73+ tag: test
74+ ```
5475
55- # Contributors to this project
56- contributors :
57- - name : " Matt Calhoun"
58- github : " mcalhoun"
76+ Full Job Example (Workflow Dispatch as a shared reusable workflow)
77+ ```yaml
78+ on:
79+ workflow_call:
80+ inputs:
81+ runs-on:
82+ description: "The runner labels on which jobs should run on"
83+ required: false
84+ type: string
85+ default: '["self-hosted"]'
86+ organization:
87+ description: "Repository owner organization (e.g. 'acme' for repo acme/example)"
88+ required: true
89+ type: string
90+ repository:
91+ description: "Repository name (e.g. 'example' for repo acme/example)"
92+ required: true
93+ type: string
94+ tag:
95+ description: "The semantic version tag of the release (e.g. 'v1.1.0')"
96+ required: true
97+ type: string
98+ outputs:
99+ branch-name:
100+ description: "Branch name"
101+ value: ${{ jobs.create-branch.outputs.branch-name }}
102+
103+ permissions:
104+ id-token: write
105+ contents: write
106+
107+ jobs:
108+ create-branch:
109+ name: build
110+ runs-on: ${{ fromJSON(inputs.runs-on) }}
111+ steps:
112+ - name: Checkout
113+ uses: actions/checkout@v4
114+
115+ - name: Parse Semver
116+ id: parse-semver
117+ uses: booxmedialtd/ws-action-parse-semver@v1
118+ with:
119+ input_string: ${{ inputs.tag }}
120+
121+ - name: Create Release Branch
122+ uses: cloudposse-github-actions/create-branch-from-tag@main
123+ env:
124+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+ with:
126+ # The following can easily just be 'release/${{ inputs.tag }}', however it is left as is
127+ # in case the tag needs to be manipulated. For example:
128+ # 'release/${{ steps.parse-semver.outputs.major }}.${{ steps.parse-semver.outputs.minor }}.x'
129+ branch: release/${{ steps.parse-semver.outputs.fullversion }}
130+ from: tags/${{ inputs.tag }}
131+ ```
0 commit comments