Skip to content

Commit

Permalink
Merge pull request #160 from dkershner6/DAK/majorReleaseTag
Browse files Browse the repository at this point in the history
chore: Major release tag workflow
  • Loading branch information
dkershner6 authored Dec 23, 2023
2 parents 0bee977 + 3174155 commit 7479936
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions .github/workflows/update main version tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".

name: Update Main Version Tag
on:
workflow_dispatch:
inputs:
target:
description: The target tag to update the main tag to
required: true
main_version:
type: choice
description: The main version to update
options:
- v2
jobs:
tag:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Git config
run: git config user.name github-actions && git config user.email [email protected]
- name: Tag New Target
run: git tag -f ${{ github.event.inputs.major_version }} ${{ github.event.inputs.target }}
- name: Push Tag
run: git push origin ${{ github.event.inputs.major_version }} --force
1 change: 1 addition & 0 deletions .gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .projen/files.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions .projenrc.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JobPermission } from "projen/lib/github/workflows-model";
import { NodePackageManager } from "projen/lib/javascript";
import {
GitHubActionTypeScriptProject,
Expand Down Expand Up @@ -55,4 +56,53 @@ const project = new GitHubActionTypeScriptProject({
},
});

const mainVersionTagWorkflow = project.github?.addWorkflow(
"Update Main Version Tag",
);
if (mainVersionTagWorkflow) {
mainVersionTagWorkflow.on({
workflowDispatch: {
inputs: {
target: {
description: "The target tag to update the main tag to",
required: true,
},
mainVersion: {
type: "choice",
description: "The main version to update",
options: ["v2"],
},
},
},
});

mainVersionTagWorkflow.addJob("tag", {
runsOn: ["ubuntu-latest"],
permissions: {
contents: JobPermission.READ,
},
steps: [
{
name: "Checkout",
uses: "actions/checkout@v2",
with: {
"fetch-depth": 0,
},
},
{
name: "Git config",
run: "git config user.name github-actions && git config user.email [email protected]",
},
{
name: "Tag New Target",
run: "git tag -f ${{ github.event.inputs.major_version }} ${{ github.event.inputs.target }}",
},
{
name: "Push Tag",
run: "git push origin ${{ github.event.inputs.major_version }} --force",
},
],
});
}

project.synth();

0 comments on commit 7479936

Please sign in to comment.