Skip to content

Commit 81951e0

Browse files
authored
Merge pull request #600 from cmu-delphi/sgratzl/release_helper
ci: add release helper
2 parents e15a2f5 + 7689b8c commit 81951e0

File tree

8 files changed

+233
-2
lines changed

8 files changed

+233
-2
lines changed

.github/release-drafter.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name-template: "v$RESOLVED_VERSION"
2+
tag-template: "v$RESOLVED_VERSION"
3+
categories:
4+
- title: "🚀 API Changes"
5+
labels:
6+
- "api change"
7+
- title: "🚀 Python Client Changes"
8+
labels:
9+
- "python client"
10+
- title: "🚀 R Client Changes"
11+
labels:
12+
- "r client"
13+
- title: "🚀 JavaScript Client Changes"
14+
labels:
15+
- "js client"
16+
- "javascript"
17+
- title: "📕 Documentation"
18+
labels:
19+
- "documentation"
20+
- title: "🧰 Development"
21+
labels:
22+
- "chore"
23+
- "documentation"
24+
- "dependencies"
25+
- "acquisition"
26+
change-template: "- #$NUMBER $TITLE"
27+
change-title-escapes: '\<*_&`#@'
28+
template: |
29+
$CHANGES
30+
31+
Thanks to $CONTRIBUTORS

.github/workflows/create-delphi-epidata-release.yml renamed to .github/workflows/create-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create Delphi Epidata Release
1+
name: Create Release
22

33
on:
44
workflow_dispatch:

.github/workflows/release-helper.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Release Helper
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
correct_repository:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: fail on fork
13+
if: github.repository_owner != 'cmu-delphi'
14+
run: exit 1
15+
16+
create_release:
17+
needs: correct_repository
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Check out code
21+
uses: actions/checkout@v2
22+
with:
23+
ssh-key: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_SSH }}
24+
- name: Set up Python 3.8
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: 3.8
28+
- name: Extract version
29+
id: extract_version
30+
run: |
31+
python -m pip install bump2version
32+
echo -n "::set-output name=version::"
33+
bump2version --dry-run --list patch | grep ^current_version | sed -r s,"^.*=",,
34+
- name: Create Release
35+
id: create_release
36+
uses: release-drafter/release-drafter@v5
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
with:
40+
version: ${{ steps.extract_version.outputs.version }}
41+
publish: true
42+
outputs:
43+
version: ${{ steps.extract_version.outputs.version }}
44+
upload_url: ${{ steps.create_release.outputs.upload_url }}
45+
tag_name: ${{ steps.create_release.outputs.tag_name }}
46+
47+
release_python_client:
48+
needs: create_release
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Check out code
52+
uses: actions/checkout@v2
53+
- name: Set up Python 3.8
54+
uses: actions/setup-python@v2
55+
with:
56+
python-version: 3.8
57+
- name: Install build dependencies
58+
run: |
59+
python -m pip install --upgrade pip
60+
pip install wheel twine
61+
- name: Prepare package
62+
run: |
63+
cp src/client/*.py src/client/packaging/pypi/delphi_epidata/
64+
- name: Create release
65+
working-directory: src/client/packaging/pypi
66+
run: |
67+
python setup.py sdist bdist_wheel
68+
- uses: actions/upload-artifact@v2
69+
with:
70+
name: delphi_epidata_py
71+
path: src/client/packaging/pypi/dist/*.tar.gz
72+
- name: Upload Release Asset
73+
uses: AButler/[email protected]
74+
with:
75+
files: "src/client/packaging/pypi/dist/*.tar.gz"
76+
repo-token: ${{ secrets.GITHUB_TOKEN }}
77+
release-tag: ${{ needs.create_release.outputs.tag_name }}
78+
- name: Publish a Python distribution to PyPI
79+
uses: pypa/gh-action-pypi-publish@release/v1
80+
with:
81+
user: __token__
82+
password: ${{ secrets.DELPHI_PYPI_PROD_TOKEN }}
83+
packages_dir: src/client/packaging/pypi/dist/
84+
skip_existing: true
85+
# repository_url: https://test.pypi.org/legacy/
86+
87+
release_js_client:
88+
needs: create_release
89+
runs-on: ubuntu-latest
90+
defaults:
91+
run:
92+
working-directory: src/client/packaging/npm
93+
steps:
94+
- name: Check out code
95+
uses: actions/checkout@v2
96+
- uses: actions/setup-node@v2
97+
with:
98+
node-version: '14.x'
99+
- name: Cache Node.js modules
100+
uses: actions/cache@v2
101+
with:
102+
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
103+
key: ${{ runner.OS }}-node2-${{ hashFiles('**/package-lock.json') }}
104+
restore-keys: |
105+
${{ runner.OS }}-node2-
106+
- run: npm ci
107+
- run: npm test
108+
- run: npm pack
109+
- name: Rename to a different name
110+
run: for f in *.tgz; do mv "$f" "$(echo "$f" | sed s/delphi_epidata-/delphi_epidata_js-/)"; done
111+
- uses: actions/upload-artifact@v2
112+
with:
113+
name: delphi_epidata_js
114+
path: src/client/packaging/npm/*.tgz
115+
- name: Upload Release Asset
116+
uses: AButler/[email protected]
117+
with:
118+
files: "src/client/packaging/npm/*.tgz"
119+
repo-token: ${{ secrets.GITHUB_TOKEN }}
120+
release-tag: ${{ needs.create_release.outputs.tag_name }}
121+
- name: Publish to NPM
122+
uses: JS-DevTools/npm-publish@v1
123+
with:
124+
token: ${{ secrets.DELPHI_NPM_TOKEN }}
125+
package: src/client/packaging/npm/package.json
126+
access: public
127+
check-version: true
128+
129+
sync_dev:
130+
needs: correct_repository
131+
runs-on: ubuntu-latest
132+
steps:
133+
- name: Check out code
134+
uses: actions/checkout@v2
135+
with:
136+
ref: dev
137+
ssh-key: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_SSH }}
138+
- name: Reset dev branch
139+
run: |
140+
git fetch origin main:main
141+
git reset --hard main
142+
- name: Create pull request into dev
143+
uses: peter-evans/create-pull-request@v3
144+
with:
145+
branch: bot/sync-main-dev
146+
commit-message: "chore: sync main-dev"
147+
base: dev
148+
title: "chore: sync main->dev"
149+
labels: chore
150+
reviewers: krivard
151+
assignees: krivard
152+
body: |
153+
Syncing Main->Dev.

src/client/packaging/npm/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/delphi_epidata.*
2-
/node_modules
2+
/node_modules
3+
/*.tgz

src/client/packaging/npm/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018 The Delphi Group at Carnegie Mellon University
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/client/packaging/npm/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Delphi Epidata API Client
2+
3+
This package provides a programmatic interface to
4+
[Delphi](https://delphi.cmu.edu/)'s epidemiological data ("epidata")
5+
API. Source code and usage information can be found at
6+
[https://github.com/cmu-delphi/delphi-epidata](https://github.com/cmu-delphi/delphi-epidata).

src/client/packaging/npm/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,22 @@
33
"description": "Delphi Epidata API Client",
44
"authors": "Delphi Group",
55
"version": "0.1.1",
6+
"license": "MIT",
7+
"homepage": "https://github.com/cmu-delphi/delphi-epidata",
8+
"bugs": {
9+
"url": "https://github.com/cmu-delphi/delphi-epidata/issues"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/cmu-delphi/delphi-epidata.git"
14+
},
615
"main": "delphi_epidata.js",
716
"types": "delphi_epidata.d.ts",
817
"browser": "delphi_epidata.js",
18+
"files": [
19+
"delphi_epidata.js",
20+
"delphi_epidata.d.ts"
21+
],
922
"scripts": {
1023
"prepack": "npx shx cp -f ../../delphi_epidata.js ../../delphi_epidata.d.ts ./",
1124
"test": "npm run prepack && jest"

src/client/packaging/pypi/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
delphi_epidata/*
2+
!delphi_epidata/__init__.py
3+
.eggs
4+
/build
5+
/dist
6+
/*.egg-info

0 commit comments

Comments
 (0)