| 1 |
name: Create Tag |
| 2 |
run-name: "${{ inputs.tag }}" |
| 3 |
on: |
| 4 |
workflow_dispatch: |
| 5 |
inputs: |
| 6 |
tag: |
| 7 |
description: 'Tag to create (e.g. v1.2.3)' |
| 8 |
required: true |
| 9 |
type: string |
| 10 |
|
| 11 |
permissions: {} |
| 12 |
|
| 13 |
jobs: |
| 14 |
create: |
| 15 |
runs-on: ubuntu-24.04 |
| 16 |
name: Create Tag |
| 17 |
if: startsWith(inputs.tag, 'v') |
| 18 |
steps: |
| 19 |
# Using a GitHub App token, because GitHub Actions doesn't run on commits from github-actions bot |
| 20 |
# Used App: |
| 21 |
# https://github.com/organizations/prometheus-community/settings/apps/helm-charts-renovate-helper. |
| 22 |
# Ref: https://github.com/prometheus-community/helm-charts/issues/5213. |
| 23 |
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 |
| 24 |
id: app-token |
| 25 |
with: |
| 26 |
client-id: 1248576 |
| 27 |
private-key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }} |
| 28 |
permission-contents: 'write' |
| 29 |
|
| 30 |
- name: Create Tag |
| 31 |
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| 32 |
env: |
| 33 |
TAG: ${{ inputs.tag }} |
| 34 |
with: |
| 35 |
github-token: ${{ steps.app-token.outputs.token }} |
| 36 |
script: | |
| 37 |
const tag = process.env.TAG; |
| 38 |
|
| 39 |
github.rest.git.createRef({ |
| 40 |
owner: context.repo.owner, |
| 41 |
repo: context.repo.repo, |
| 42 |
ref: 'refs/tags/' + tag, |
| 43 |
sha: context.sha, |
| 44 |
}); |