Skip to content

Commit

Permalink
release: github token from env var
Browse files Browse the repository at this point in the history
  • Loading branch information
cirosantilli committed Sep 23, 2018
1 parent 7183fec commit f90e690
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 4 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10959,6 +10959,7 @@ Create a release:
....
git clone https://github.com/cirosantilli/linux-kernel-module-cheat linux-kernel-module-cheat-release
cd linux-kernel-module-cheat-release
# export LKMC_GITHUB_TOKEN=<your-token>
./release
....

Expand Down Expand Up @@ -11000,13 +11001,14 @@ which you can then upload somewhere.
For example, you can create or update a GitHub release and upload automatically with:

....
git push
printf "$GITHUB_TOKEN" > "$(./getvar github_token_file)"
# export LKMC_GITHUB_TOKEN=<your-token>
./release-upload
....

Source: link:release-upload[]

Create `LKMC_GITHUB_TOKEN` under: https://github.com/settings/tokens/new and save it to your `.bashrc`.

TODO: generalize that so that people can upload to their forks.

=== Fairy tale
Expand Down
5 changes: 1 addition & 4 deletions common.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
qemu_src_dir = os.path.join(submodules_dir, 'qemu')
parsec_benchmark_src_dir = os.path.join(submodules_dir, 'parsec-benchmark')
ccache_dir = os.path.join('/usr', 'lib', 'ccache')
github_token_file = os.path.join(data_dir, 'github-token')
arch_map = {
'a': 'arm',
'A': 'aarch64',
Expand Down Expand Up @@ -236,9 +235,7 @@ def github_make_request(
headers = {'Accept': 'application/vnd.github.v3+json'}
headers.update(extra_headers)
if authenticate:
with open(this.github_token_file, 'r') as f:
token = f.read().rstrip()
headers['Authorization'] = 'token ' + token
headers['Authorization'] = 'token ' + os.environ['LKMC_GITHUB_TOKEN']
if url_params is not None:
path += '?' + urllib.parse.urlencode(url_params)
request = urllib.request.Request(
Expand Down
1 change: 0 additions & 1 deletion release
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ start_time = time.time()
subprocess.check_call([os.path.join(common.root_dir, 'configure'), '--all'])
subprocess.check_call([os.path.join(common.root_dir, 'build-all')])
release_zip.main()
subprocess.check_call(['git', 'tag', common.sha])
subprocess.check_call(['git', 'push'])
release_upload.main()
end_time = time.time()
Expand Down

0 comments on commit f90e690

Please sign in to comment.