Skip to content

Commit f6e8a58

Browse files
authored
Include version in workflow (FAForever#468)
* Include version in workflow * escape slashes * remove version from dev profile * fix version name * ensure version is used * fix name * remove start indicator
1 parent ea5a366 commit f6e8a58

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎.github/workflows/build.yaml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ jobs:
3535
MYSQL_USER: faf-league-service
3636
MYSQL_PASSWORD: banana
3737
steps:
38+
- name: Get the version
39+
id: get_version
40+
run: |
41+
if [[ ${{ github.ref }} =~ refs\/tags\/.* ]]; then
42+
echo ::set-output name=API_VERSION::${GITHUB_REF#refs/tags/}
43+
else
44+
echo ::set-output name=API_VERSION::${GITHUB_SHA}
45+
fi
3846
- name: Install tools
3947
run: apt update && apt install -y git wget
4048
- name: Checkout code
@@ -51,10 +59,11 @@ jobs:
5159
flyway migrate
5260
- name: Gradle build
5361
env:
62+
API_VERSION: ${{ steps.get_version.outputs.API_VERSION }}
5463
GRADLE_CLI_OPTS: "--console=plain --stacktrace --quiet"
5564
DATABASE_ADDRESS: faf-db
5665
LEAGUE_DATABASE_ADDRESS: faf-league-db
57-
run: "chmod +x ./gradlew && ./gradlew ${GRADLE_CLI_OPTS} build jacocoTestReport"
66+
run: "chmod +x ./gradlew && ./gradlew ${GRADLE_CLI_OPTS} -Pversion=${API_VERSION} build jacocoTestReport"
5867
- name: Build and push Docker images
5968
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags')
6069
uses: docker/build-push-action@v1.1.1

‎build.gradle‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ tasks.withType(Test) {
9898
}
9999

100100
group = 'faforever'
101-
version = 'snapshot'
102101

103102
sourceCompatibility = 15
104103
targetCompatibility = 15

‎gradle.properties‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
version=snapshot
12
profile=dev
23
springDependencyManagementVersion=1.0.11.RELEASE
34
springBootVersion=2.3.9.RELEASE

‎src/main/resources/config/application-dev.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
faf-api:
2-
version: dev
32
jwt:
43
secretKeyPath: ${JWT_PRIVATE_KEY_PATH:test-pki-private.key}
54
publicKeyPath: ${JWT_PUBLIC_KEY_PATH:test-pki-public.key}

0 commit comments

Comments
 (0)