File tree Expand file tree Collapse file tree
java/ru/flashcards/telegram Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 deploy :
99 runs-on : ubuntu-latest
1010 environment : production
11+ env :
12+ APP_VERSION : ${{ github.event.release.tag_name }}
1113
1214 steps :
1315 - name : Checkout repository
@@ -33,13 +35,15 @@ jobs:
3335 echo "tomcat.url=${{ secrets.SERVER_URL }}" >> $GITHUB_ENV
3436 echo "tomcat.user=${{ secrets.TOMCAT_USERNAME }}" >> $GITHUB_ENV
3537 echo "tomcat.password=${{ secrets.TOMCAT_PASSWORD }}" >> $GITHUB_ENV
38+ echo "app.version=${APP_VERSION}" > src/main/resources/version.properties
3639
3740 - name : Deploy to Tomcat
3841 run : mvn tomcat7:deploy -DskipTests
3942 env :
43+ APP_VERSION : ${{ env.APP_VERSION }}
4044 SERVER_URL : ${{ secrets.SERVER_URL }}
4145 TOMCAT_USERNAME : ${{ secrets.TOMCAT_USERNAME }}
4246 TOMCAT_PASSWORD : ${{ secrets.TOMCAT_PASSWORD }}
4347 BOT_DB_URL : ${{ secrets.BOT_DB_URL }}
4448 BOT_DB_USER : ${{ secrets.BOT_DB_USER }}
45- BOT_DB_PASS : ${{ secrets.BOT_DB_PASS }}
49+ BOT_DB_PASS : ${{ secrets.BOT_DB_PASS }}
Original file line number Diff line number Diff line change 44import org .springframework .boot .autoconfigure .SpringBootApplication ;
55import org .springframework .boot .context .properties .EnableConfigurationProperties ;
66import org .springframework .boot .web .servlet .support .SpringBootServletInitializer ;
7+ import org .springframework .context .annotation .PropertySource ;
78import org .springframework .scheduling .annotation .EnableScheduling ;
89import ru .flashcards .telegram .bot .config .TelegramProperties ;
910
1011@ SpringBootApplication
1112@ EnableScheduling
1213@ EnableConfigurationProperties (TelegramProperties .class )
14+ @ PropertySource ("classpath:version.properties" )
1315public class Application extends SpringBootServletInitializer {
1416 public static void main (String [] args ) {
1517 SpringApplication .run (Application .class , args );
Original file line number Diff line number Diff line change 55import lombok .AllArgsConstructor ;
66import org .slf4j .Logger ;
77import org .slf4j .LoggerFactory ;
8+ import org .springframework .core .env .Environment ;
89import org .springframework .http .HttpStatus ;
910import org .springframework .http .ResponseEntity ;
1011import org .springframework .web .bind .annotation .GetMapping ;
@@ -33,6 +34,7 @@ public class WebhookController {
3334 private MessageFactoryProvider messageFactoryProvider ;
3435 private CallbackFactoryProvider callbackFactoryProvider ;
3536 private UserModeSettings userModeSettings ;
37+ private Environment environment ;
3638
3739 @ PostMapping ("/webhook" )
3840 public void onUpdateReceived (@ RequestBody Update update ) {
@@ -46,9 +48,9 @@ public void onUpdateReceived(@RequestBody Update update) {
4648 logger .error ("Internal error" , e );
4749 }
4850 }
49- @ GetMapping ("/test " )
50- public ResponseEntity <String > test () {
51- return ResponseEntity .status (HttpStatus .OK ).body ("1.3.4" );
51+ @ GetMapping ("/version " )
52+ public ResponseEntity <String > version () {
53+ return ResponseEntity .status (HttpStatus .OK ).body (environment . getProperty ( "app.version" , "unknown" ) );
5254 }
5355
5456 private List <BotApiMethod <?>> handleMessageInput (Message message ) {
@@ -98,4 +100,4 @@ private void execute(List<BotApiMethod<?>> response) {
98100 }
99101 });
100102 }
101- }
103+ }
Original file line number Diff line number Diff line change 1+ app.version =local
You can’t perform that action at this time.
0 commit comments