Skip to content

Commit

Permalink
Add support for working with tag pushes
Browse files Browse the repository at this point in the history
Change-type: minor
  • Loading branch information
thgreasi committed Jun 23, 2022
1 parent 124ea0f commit 89aa683
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,21 @@ export async function run(
let buildOptions = null;

// If we are pushing directly to the target branch then just build a release without draft flag
if (context.eventName === 'push' && context.ref === `refs/heads/${target}`) {
if (
context.eventName === 'push' &&
(context.ref === `refs/heads/${target}` ||
context.ref.startsWith('/refs/tags/'))
) {
// TODO: Update this to use ref_type & ref_name once that becomes available
// See: https://github.com/actions/toolkit/pull/935/files
const tagName = context.ref.match(/^\/refs\/tags\/(\w+)/)?.[1];
// Make a final release because context is master workflow
buildOptions = {
draft: false,
tags: { sha: context.sha },
tags: {
sha: context.sha,
...(!!tagName && { tag: tagName }),
},
};
} else if (context.eventName !== 'pull_request') {
// Make sure the only events now are Pull Requests
Expand Down

0 comments on commit 89aa683

Please sign in to comment.