Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Major release tag workflow #160

Merged
merged 3 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
Loading
Loading