Skip to content

Commit

Permalink
Merge pull request #345 from kbst/test-do-promotion
Browse files Browse the repository at this point in the history
Use actions script to create ref and trigger workflow
  • Loading branch information
pst authored Sep 10, 2023
2 parents 3c483d7 + 367bd2a commit b54906a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,26 @@ jobs:
needs: publish
if: startsWith(github.ref, 'refs/heads/release-')

permissions:
contents: write # required for createRef
actions: write # required for createWorkflowDispatch

steps:
- uses: actions/[email protected]
- run: |
export TAG=$(echo $GITHUB_REF | sed -e "s#^refs/heads/release-##")
git tag $TAG
git tag | grep $TAG
git push origin $TAG
- uses: actions/github-script@v6
with:
script: |
const tag = context.ref.replace("refs/heads/release-", "")
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
tag,
context.sha,
});
octokit.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
'promote.yml',
tag,
});
6 changes: 1 addition & 5 deletions .github/workflows/promote.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Promote

on:
push:
branches:
- "!*" # do not run for branches
tags:
- "*" # run for tags
workflow_dispatch:

jobs:
#
Expand Down

0 comments on commit b54906a

Please sign in to comment.