-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'aws-samples:main' into dynamodb-ack
- Loading branch information
Showing
5 changed files
with
510 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Release | ||
on: | ||
milestone: | ||
types: [closed] | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Release | ||
working-directory: releaser | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
MILESTONE_NUMBER: "${{ github.event.milestone.number }}" | ||
run: | | ||
npm install | ||
npm run exec | ||
- name: Set Git config | ||
run: | | ||
git config user.name 'github-actions[bot]' | ||
git config user.email 'github-actions[bot]@users.noreply.github.com' | ||
- name: Update stable branch | ||
run: | | ||
git fetch --unshallow | ||
git checkout stable | ||
git pull | ||
git merge --no-ff main -m "Publish to stable" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# EKS Workshop - Releases | ||
|
||
The EKS Workshop will publish a new version on the last Friday of each month containing all PRs merged to the `main` branch during that time. This will update the content on https://eksworkshop.com and publish a new version to Workshop Studio for AWS events. The changes for the release each month will be publish as a GitHub Release with a corresponding changelog. | ||
|
||
There may be releases published off-schedule for specific events like re:Invent and Kubecon, as well as updates made during the month for critical bug fixes. | ||
|
||
Each release will have a corresponding GitHub milestone associated with it to track the changes that will be released during that interval. This allows contributors to understand when their contribution will be published, and users of the workshop to understand what changes will be published ahead of time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import { Octokit } from "@octokit/rest"; | ||
|
||
let repository = process.env.GITHUB_REPOSITORY | ||
let sha = process.env.GITHUB_SHA | ||
let milestoneNumber = process.env.MILESTONE_NUMBER | ||
|
||
let auth = process.env.GITHUB_TOKEN | ||
|
||
let repositoryParts = repository.split('/'); | ||
let owner = repositoryParts[0]; | ||
let repo = repositoryParts[1]; | ||
|
||
let tagName = `release-${Math.floor(Date.now() / 1000)}` | ||
|
||
const octokit = new Octokit({ | ||
auth | ||
}); | ||
|
||
const categories = [{ | ||
title: "## 🚀 New labs", | ||
label: 'new' | ||
}, { | ||
title: "## ✨ Updated labs", | ||
label: 'update' | ||
}, { | ||
title: "## 🐛 Fixes", | ||
label: 'fix' | ||
}, { | ||
title: "## 🧪 Features", | ||
label: 'feat' | ||
}] | ||
|
||
let entries = {}; | ||
|
||
let milestone = await octokit.rest.issues.getMilestone({ | ||
owner, | ||
repo, | ||
milestone_number: milestoneNumber, | ||
}); | ||
|
||
for await (const response of octokit.paginate.iterator( | ||
octokit.rest.pulls.list, | ||
{ | ||
owner, | ||
repo, | ||
state: 'closed' | ||
}, | ||
)) { | ||
response.data.forEach((e) => { | ||
if(e.milestone) { | ||
if(e.milestone.number == milestoneNumber) { | ||
categories.forEach((c) => { | ||
let targetPrefix = `${c.label}:`; | ||
|
||
if(e.title.indexOf(targetPrefix) == 0) { | ||
if(!entries[c.title]) { | ||
entries[c.title] = []; | ||
} | ||
|
||
entries[c.title].push({ | ||
number: e.number, | ||
title: e.title.substring(targetPrefix.length + 1), | ||
url: e.html_url, | ||
author: { | ||
login: e.user.login, | ||
url: e.user.html_url, | ||
} | ||
}); | ||
} | ||
}) | ||
} | ||
} | ||
}) | ||
} | ||
|
||
let output = ''; | ||
|
||
categories.forEach((c) => { | ||
let categoryOutput = `${c.title} | ||
`; | ||
if(entries[c.title]) { | ||
let categoryEntries = entries[c.title]; | ||
|
||
if(categoryEntries.length > 0) { | ||
categoryEntries.forEach((e) => { | ||
categoryOutput += `- ${e.title} by [@${e.author.login}](${e.author.url}) ([#${e.number}](${e.url}))\n` | ||
}); | ||
|
||
output += `${categoryOutput} \n`; | ||
} | ||
} | ||
}); | ||
|
||
await octokit.rest.git.createRef({ | ||
owner, | ||
repo, | ||
ref: `refs/tags/${tagName}`, | ||
sha, | ||
}); | ||
|
||
await octokit.rest.repos.createRelease({ | ||
owner, | ||
repo, | ||
tag_name: tagName, | ||
name: milestone.data.title, | ||
body: output | ||
}); |
Oops, something went wrong.