Skip to content

Commit aedeaa2

Browse files
committed
Improve README and add GitHub action to publish Docker image
1 parent e9a81f3 commit aedeaa2

File tree

4 files changed

+63
-11
lines changed

4 files changed

+63
-11
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags:
8+
- 'v*'
9+
10+
jobs:
11+
publish-image:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
17+
- name: Login to DockerHub
18+
uses: docker/login-action@v1
19+
with:
20+
username: ${{ secrets.DOCKERHUB_USERNAME }}
21+
password: ${{ secrets.DOCKERHUB_TOKEN }}
22+
23+
- name: Log in GitHub Docker registry
24+
uses: docker/login-action@v1
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Extract metadata (tags, labels) for Docker
31+
id: meta
32+
uses: docker/metadata-action@v3
33+
with:
34+
images: |
35+
nevermendel/leetcode-export
36+
tags: |
37+
type=ref,event=branch
38+
type=ref,event=pr
39+
type=semver,pattern={{version}}
40+
type=semver,pattern={{major}}.{{minor}}
41+
42+
- name: Build and push Docker images
43+
uses: docker/build-push-action@v2
44+
with:
45+
context: .
46+
push: true
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ WORKDIR /usr/app
1414
RUN mkdir -p out
1515

1616
# Install leetcode-export
17-
python3 ./setup.py install
17+
RUN python3 ./setup.py install
1818

1919
ENTRYPOINT ["leetcode-export", "--folder", "out"]

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ section [Docker Image here](#docker-image).
2323

2424
## How to use
2525

26-
To use it locally you can either download it from pypi.org or you can clone this repository.
26+
To use `leetcode-export` you can either download it from pypi.org or you can clone this repository.
2727

2828
## Download from pypi.org
2929

30-
Execute `pip install leetcode-export` to download it and install all the needed dependencies. You might need to use `pip3`
30+
Run `pip install leetcode-export` to download it and install all the needed dependencies. You might need to use `pip3`
3131
depending on the configuration of your system.
3232

3333
### Clone the repository
3434

3535
Clone this repository:
3636

3737
```bash
38-
git clone https://github.com/NeverMendel/leetcode-exports
38+
git clone https://github.com/NeverMendel/leetcode-export
3939
```
4040

4141
Install all the needed dependencies:
@@ -95,11 +95,14 @@ optional arguments:
9595
9696
## Login
9797
98-
To download your submissions you need to log in your LeetCode account by providing the cookies.
98+
To download your submissions you need to log in your LeetCode account by providing the cookies. To log in using cookies,
99+
you need to get them from a session where you are already logged in.
99100
100-
To log in using cookies, you need to get them from a session where you are already logged in. Login in your LeetCode
101-
account in your browser, open the browser's Dev Tool, click on the Network tab and copy the cookie header that is sent
102-
when you visit any leetcode webpage.
101+
**Steps required**:
102+
- Login in your LeetCode account in your browser
103+
- Open the browser's Dev Tool
104+
- Click on the Network tab
105+
- Copy the cookie header that can be found under Request Headers in any leetcode.com request.
103106
104107
You can insert the cookie string that you have just copied in the interactive menu (recommended) or you can pass it as a
105108
program argument when lunching the script, like in the following example:
@@ -108,7 +111,7 @@ program argument when lunching the script, like in the following example:
108111
python leetcode-export --cookies {COOKIES}
109112
```
110113

111-
Using the interactive menu is to be preferred as it will avoid storing your cookies in the command history.
114+
Using the interactive menu is preferred as it will avoid storing your cookies in the command history.
112115

113116
## Filename template arguments
114117

@@ -163,6 +166,7 @@ date_formatted: str
163166
extension: str
164167
```
165168

169+
166170
Default submission filename
167171
template: `${date_formatted} - ${status_display} - runtime ${runtime} - memory ${memory}.${extension}`
168172

@@ -174,4 +178,4 @@ The license of leetcode-cli is available [here](https://github.com/skygragon/lee
174178

175179
## License
176180

177-
[Apache License 2.0](LICENSE)
181+
[MIT License](LICENSE)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name='leetcode-export',
8-
version='1.0',
8+
version='1.1',
99
url='https://github.com/NeverMendel/leetcode-export',
1010
license='MIT',
1111
author='Davide Cazzin',

0 commit comments

Comments
 (0)