Skip to content

Commit 81a3afa

Browse files
author
Dhwaneet Bhatt
committed
Using GitHub Actions to automate releases
1 parent 3863c4d commit 81a3afa

File tree

5 files changed

+145
-3
lines changed

5 files changed

+145
-3
lines changed
+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Draft new release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: The version you want to release. Must be a valid semver version.
8+
required: true
9+
type: string
10+
11+
jobs:
12+
draft-new-release:
13+
if: startsWith(github.event.inputs.version, 'v')
14+
name: Draft a new release
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v3
23+
24+
- name: Create release branch
25+
run: git checkout -b release/${{ github.event.inputs.version }}
26+
27+
- name: Update changelog
28+
uses: thomaseizinger/keep-a-changelog-new-release@1.1.0
29+
with:
30+
version: ${{ github.event.inputs.version }}
31+
32+
- name: Initialize mandatory git config
33+
run: |
34+
git config user.name "GitHub Actions"
35+
git config user.email noreply@github.com
36+
37+
- name: Bump version
38+
run: npm version ${{ github.event.inputs.version }} --git-tag-version false
39+
40+
- name: Commit changelog and manifest files
41+
id: make-commit
42+
run: |
43+
git add CHANGELOG.md package.json package-lock.json
44+
git commit --message "Prepare release ${{ github.event.inputs.version }}"
45+
echo "::set-output name=commit::$(git rev-parse HEAD)"
46+
47+
- name: Push new branch
48+
run: git push origin release/${{ github.event.inputs.version }}
49+
50+
- name: Create pull request for master
51+
uses: thomaseizinger/create-pull-request@1.0.0
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
with:
55+
head: release/${{ github.event.inputs.version }}
56+
base: master
57+
title: "Release version ${{ github.event.inputs.version }}"
58+
reviewers: ${{ github.actor }}
59+
body: |
60+
Hi @${{ github.actor }}!
61+
62+
This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}.
63+
I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit }}.
64+
65+
- name: Create pull request for develop
66+
uses: thomaseizinger/create-pull-request@1.0.0
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
with:
70+
head: release/${{ github.event.inputs.version }}
71+
base: develop
72+
title: "Release version ${{ github.event.inputs.version }}"
73+
reviewers: ${{ github.actor }}
74+
body: |
75+
Hi @${{ github.actor }}!
76+
77+
This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}.
78+
I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit }}.
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "Publish new release"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
types:
8+
- closed
9+
10+
jobs:
11+
release:
12+
name: Publish new release
13+
runs-on: ubuntu-latest
14+
# only merged pull requests that begin with 'release/' or 'hotfix/' must trigger this job
15+
if: github.event.pull_request.merged == true &&
16+
(contains(github.event.pull_request.head.ref, 'release/') || contains(github.event.pull_request.head.ref, 'hotfix/'))
17+
permissions:
18+
contents: write
19+
20+
steps:
21+
- name: Extract version from branch name (for release branches)
22+
if: contains(github.event.pull_request.head.ref, 'release/')
23+
run: |
24+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
25+
VERSION=${BRANCH_NAME#release/}
26+
27+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
28+
29+
- name: Extract version from branch name (for hotfix branches)
30+
if: contains(github.event.pull_request.head.ref, 'hotfix/')
31+
run: |
32+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
33+
VERSION=${BRANCH_NAME#hotfix/}
34+
35+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
36+
37+
- name: Create Release
38+
uses: thomaseizinger/create-release@1.0.0
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
target_commitish: ${{ github.event.pull_request.merge_commit_sha }}
43+
tag_name: ${{ env.RELEASE_VERSION }}
44+
name: ${{ env.RELEASE_VERSION }}
45+
draft: false
46+
prerelease: false
File renamed without changes.

CHANGELOG.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
v1.7.1 (March 29, 2023)
2-
* Minor fix - Add language labels for Rust and Kotlin
1+
# Postman Code Generators Changelog
2+
3+
## [Unreleased]
4+
5+
### Fixed
6+
7+
- Fix for - [#11934](https://github.com/postmanlabs/postman-app-support/issues/11934) Prevent `%` double encoding in query params
8+
9+
## [v1.7.1] - 2023-03-29
10+
11+
- Minor fix - Add language labels for Rust and Kotlin
12+
13+
## Previous Releases
14+
15+
Newer releases follow the [Keep a Changelog](https://keepachangelog.com) format.
316

417
v1.7.0 (March 28, 2023)
518
* Fix for - [#192](https://github.com/postmanlabs/postman-code-generators/issues/192) Added support for Rust reqwest code snippets.
@@ -101,3 +114,7 @@ v1.0.0 (May 29, 2020)
101114
- Add axios framework support
102115
- Add ES6 syntax support for NodeJS Request, NodeJS Native and NodeJS Unirest
103116
- Fix snippet generation for powershell and jquery, where form data params had no type field
117+
118+
[Unreleased]: https://github.com/postmanlabs/postman-code-generators/compare/v1.7.1...HEAD
119+
120+
[v1.7.1]: https://github.com/postmanlabs/postman-code-generators/compare/v1.7.0...v1.7.1

codegens/java-unirest/lib/parseRequest.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ var _ = require('./lodash'),
33
sanitize = require('./util').sanitize;
44

55
/**
6-
* Encode param except the following characters- [,{,},],%
6+
* Encode param except the following characters- [,],%
7+
* Characters { and } are kept encoded because unirest does not support them
78
*
89
* @param {String} param
910
* @returns {String}

0 commit comments

Comments
 (0)