Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions .github/release_pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Description
Looking for the PR for the upcoming RELEASE_DESCRIPTION? Well, you've just found it, congratulations!

## Release checklist

- [ ] Check to see if there are any errors in Sentry that have only occurred since the last production release
- [ ] Verify that all feature flags are flipped appropriately
- [ ] If there are any new metrics, ensure that central and desktop.github.com have been updated
47 changes: 47 additions & 0 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 'Create Release Pull Request'

on:
create:
branches:
- releases/*

jobs:
build:
name: Create Release Pull Request
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v2
if: ${{ !contains(github.ref, 'test') }}

- name: Create Pull Request content
if: ${{ !contains(github.ref, 'test') }}
run: |
PR_TITLE=`./script/draft-release/release-pr-content.sh title ${GITHUB_REF#refs/heads/}`
PR_BODY=`./script/draft-release/release-pr-content.sh body ${GITHUB_REF#refs/heads/}`

echo "PR_BODY<<EOF" >> $GITHUB_ENV
echo "$PR_BODY" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV

echo "PR_TITLE<<EOF" >> $GITHUB_ENV
echo "$PR_TITLE" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV

- uses: tibdex/github-app-token@v1
id: generate-token
if: ${{ !contains(github.ref, 'test') }}
with:
app_id: ${{ secrets.RELEASE_PRS_APP_ID }}
private_key: ${{ secrets.RELEASE_PRS_APP_PRIVATE_KEY }}

- name: Create Release Pull Request
uses: peter-evans/create-pull-request@v4.0.4
if: ${{ !contains(github.ref, 'test') }}
with:
token: ${{ steps.generate-token.outputs.token }}
title: ${{ env.PR_TITLE }}
body: ${{ env.PR_BODY }}
branch: ${{ github.ref }}
base: development
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"productName": "GitHub Desktop",
"bundleID": "com.github.GitHubClient",
"companyName": "GitHub, Inc.",
"version": "3.0.2-beta2",
"version": "3.0.2",
"main": "./main.js",
"repository": {
"type": "git",
Expand Down
11 changes: 11 additions & 0 deletions changelog.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
{
"releases": {
"3.0.2": [
"[Improved] Add support for SSH password prompts when accessing repositories - #14676",
"[Fixed] Fix Markdown syntax highlighting - #14710",
"[Fixed] Fix crash launching the app on macOS High Sierra - #14712",
"[Added] Add support for Aptana Studio - #14669. Thanks @tsvetilian-ty!"
],
"3.0.2-beta5": [
"[Improved] Add support for SSH password prompts when accessing repositories - #14676",
"[Fixed] Fix Markdown syntax highlighting - #14710",
"[???] Fix leaked background process on Windows - #14733. Thanks @tsvetilian-ty!"
],
"3.0.2-beta2": [
"[Fixed] Fix crash launching the app on macOS High Sierra - #14712"
],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"rebuild-hard:dev": "yarn clean-slate && yarn build:dev",
"rebuild-hard:prod": "yarn clean-slate && yarn build:prod",
"draft-release": "ts-node -P script/tsconfig.json script/draft-release/index.ts",
"draft-release:pr": "ts-node -P script/tsconfig.json script/draft-release/draft-pull-request.ts",
"draft-release:format": "prettier --check --write changelog.json app/package.json && yarn validate-changelog",
"validate-changelog": "ts-node -P script/tsconfig.json script/validate-changelog.ts"
},
Expand Down
57 changes: 57 additions & 0 deletions script/draft-release/draft-pull-request.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/// <reference path="../globals.d.ts" />

import appPackage from '../../app/package.json'

const numberToOrdinal = (n: number) => {
const s = ['th', 'st', 'nd', 'rd']
const v = n % 100
return n + (s[(v - 20) % 10] || s[v] || s[0])
}

function getPullRequestBody(fullVersion: string): string {
const versionComponents = fullVersion.split('-')
const version = versionComponents[0]

let releaseDescription = `v${version} production release`
if (versionComponents.length > 1) {
const channelVersion = versionComponents[1]
if (!channelVersion.startsWith('beta')) {
throw new Error('We should not create release PRs for test builds')
}

const buildNumber = parseInt(channelVersion.substring('beta'.length))
releaseDescription = `${numberToOrdinal(
buildNumber
)} beta of the v${version} series`
}

return `## Description
Looking for the PR for the upcoming ${releaseDescription}? Well, you've just found it, congratulations!

## Release checklist

- [ ] Check to see if there are any errors in Sentry that have only occurred since the last production release
- [ ] Verify that all feature flags are flipped appropriately
- [ ] If there are any new metrics, ensure that central and desktop.github.com have been updated
`
}

function getPullRequestTitle(fullVersion: string): string {
return `Release ${fullVersion}`
}

process.on('unhandledRejection', error => {
console.error(error.message)
})

const args = process.argv.slice(2)
const type = args[0]
if (type !== 'title' && type !== 'body') {
throw new Error(`Invalid type ${type}, only 'title' and 'body' allowed`)
}

const result =
type === 'title'
? getPullRequestTitle(appPackage.version)
: getPullRequestBody(appPackage.version)
console.log(result)
49 changes: 49 additions & 0 deletions script/draft-release/release-pr-content.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh

if [ "$#" -ne 2 ]; then
echo "Usage: $0 <title|body> <branch-name>"
exit 1
fi

OUTPUT_TYPE=$1
BRANCH_NAME=$2
VERSION=$(echo ${BRANCH_NAME#releases/})

# For title just echo "Release version"
if [ "$OUTPUT_TYPE" = "title" ]; then
echo "Release ${VERSION}"
exit 0
fi

# If output type is not body, exit
if [ "$OUTPUT_TYPE" != "body" ]; then
echo "Unknown output type: $OUTPUT_TYPE"
exit 1
fi

RELEASE_DESCRIPTION="v${VERSION} production release"
if [[ "$VERSION" == *"-"* ]]; then
BUILD_TYPE_AND_NUMBER=$(echo ${VERSION##*-})
if [[ "$BUILD_TYPE_AND_NUMBER" != *"beta" ]]; then
echo "Only beta and production builds have release PRs"
fi
BUILD_TYPE="beta"
BUILD_NUMBER=$(echo ${BUILD_TYPE_AND_NUMBER:4})
case $BUILD_NUMBER in
*1[0-9] | *[04-9]) BUILD_NUMBER_SUFFIX="th";;
*1) BUILD_NUMBER_SUFFIX="st";;
*2) BUILD_NUMBER_SUFFIX="nd";;
*3) BUILD_NUMBER_SUFFIX="rd";;
esac

RELEASE_DESCRIPTION="${BUILD_NUMBER}${BUILD_NUMBER_SUFFIX} beta of the v${VERSION} series"
fi

echo "## Description
Looking for the PR for the upcoming ${RELEASE_DESCRIPTION}? Well, you've just found it, congratulations!

## Release checklist

- [ ] Check to see if there are any errors in Sentry that have only occurred since the last production release
- [ ] Verify that all feature flags are flipped appropriately
- [ ] If there are any new metrics, ensure that central and desktop.github.com have been updated"