File tree Expand file tree Collapse file tree 4 files changed +29
-7
lines changed Expand file tree Collapse file tree 4 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,5 @@ static/upload
13
13
venv /
14
14
.venv
15
15
.coverage
16
- htmlcov
16
+ htmlcov
17
+ .git /
Original file line number Diff line number Diff line change @@ -114,16 +114,21 @@ jobs:
114
114
username : ${{ secrets.DOCKER_USERNAME }}
115
115
password : ${{ secrets.DOCKER_PASSWORD }}
116
116
117
+ # We need to checkout the repository in order for the "Create Sentry release" to work
118
+ - name : Checkout repository
119
+ uses : actions/checkout@v2
120
+
121
+ - name : Prepare version file
122
+ run : |
123
+ echo "${{ github.ref }}" > .version
124
+
117
125
- name : Build image and publish to Docker Registry
118
126
uses : docker/build-push-action@v3
119
127
with :
128
+ context : .
120
129
push : true
121
130
tags : ${{ steps.meta.outputs.tags }}
122
131
123
- # We need to checkout the repository in order for the "Create Sentry release" to work
124
- - name : Checkout repository
125
- uses : actions/checkout@v2
126
-
127
132
- name : Create Sentry release
128
133
uses : getsentry/action-release@v1
129
134
env :
Original file line number Diff line number Diff line change
1
+ dev
Original file line number Diff line number Diff line change 2
2
import random
3
3
import socket
4
4
import string
5
- import subprocess
6
5
from ast import literal_eval
6
+ from pathlib import Path
7
7
from typing import Callable , List
8
8
from urllib .parse import urlparse
9
9
10
10
from dotenv import load_dotenv
11
11
12
- SHA1 = subprocess .getoutput ("git rev-parse HEAD" )
12
+ DEFAULT_VERSION = "unknown"
13
+
14
+
15
+ def load_version () -> str :
16
+ try :
17
+ this_file_path = Path (__file__ )
18
+ root_dir_path = this_file_path .parent .parent
19
+ version_file_path = root_dir_path .joinpath (".version" )
20
+ with open (version_file_path , "r" ) as f :
21
+ return f .readline ().strip ()
22
+ except Exception :
23
+ print ("Could not load .version. Using default version" )
24
+ return DEFAULT_VERSION
25
+
26
+
27
+ SHA1 = load_version ()
13
28
ROOT_DIR = os .path .abspath (os .path .dirname (os .path .dirname (__file__ )))
14
29
15
30
You can’t perform that action at this time.
0 commit comments