Skip to content

Commit a487a9b

Browse files
committed
fixed syntax
1 parent 030713b commit a487a9b

3 files changed

Lines changed: 22 additions & 18 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ on:
88
permissions:
99
contents: read
1010

11-
jobs:
12-
13-
env:
14-
GIT_USER_NAME: GitHub Pipeline
15-
GIT_USER_EMAIL: github_pipeline@fairagro.net
16-
IMAGE_NAME: zalf/fairagro_advanced_middleware_api
11+
env:
12+
GIT_USER_NAME: GitHub Pipeline
13+
GIT_USER_EMAIL: github_pipeline@fairagro.net
14+
IMAGE_NAME: zalf/fairagro_advanced_middleware_api
1715

18-
determine-version:
16+
jobs:
17+
version:
1918
runs-on: ubuntu-latest
2019

2120
permissions:
@@ -42,14 +41,19 @@ jobs:
4241
github-token: ${{ secrets.GITHUB_TOKEN }}
4342
script: |
4443
const allowedLabels = ["major version","minor version","patch version"];
45-
const labels = context.payload.pull_request.labels.map(l => l.name);
44+
const pr = context.payload.pull_request;
45+
if (!pr) {
46+
core.setFailed("This workflow must be triggered by a pull_request event.");
47+
return;
48+
}
49+
const labels = pr.labels.map(l => l.name);
4650
const matching = labels.filter(l => allowedLabels.includes(l));
4751
if (matching.length !== 1) {
4852
core.setFailed(
4953
`PR must have exactly one version label: ${allowedLabels.join(", ")}. Found: ${matching.join(", ") || "none"}`
5054
);
5155
} else {
52-
core.setOutput("bump", matching[0].replace(" version",""));
56+
return { bump: matching[0].replace(" version","") };
5357
}
5458
5559
# GitVersion für main Merge
@@ -66,7 +70,8 @@ jobs:
6670
increment: ${{ steps.version-bump.outputs.bump }}
6771

6872
- name: Show calculated version
69-
run: 'echo "Calculated Version: ${{ steps.gitversion.outputs.SemVer }}"'
73+
run: |
74+
echo "Calculated Version: ${{ steps.gitversion.outputs.SemVer }}"
7075
7176
- name: Show computed feature version
7277
run: |
@@ -86,7 +91,7 @@ jobs:
8691

8792
docker-build-main:
8893
runs-on: ubuntu-latest
89-
needs: determine-version
94+
needs: version
9095

9196
steps:
9297
- name: Checkout repo
@@ -123,7 +128,7 @@ jobs:
123128

124129
create-release:
125130
runs-on: ubuntu-latest
126-
needs: docker-build-main
131+
needs: version
127132

128133
permissions:
129134
contents: write
@@ -132,9 +137,9 @@ jobs:
132137
- name: Create GitHub Release
133138
uses: ncipollo/release-action@v1
134139
with:
135-
tag: v${{ needs.determine-version.outputs.SemVer }}
136-
name: "Release v${{ needs.determine-version.outputs.SemVer }}"
140+
tag: v${{ needs.version.outputs.SemVer }}
141+
name: "Release v${{ needs.version.outputs.SemVer }}"
137142
body: |
138-
Docker image: `${{ env.IMAGE_NAME }}:v${{ needs.determine-version.outputs.SemVer }}`
143+
Docker image: `${{ env.IMAGE_NAME }}:v${{ needs.version.outputs.SemVer }}`
139144
draft: false
140145
prerelease: false

.github/workflows/feature-build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55

66
permissions:
7-
contents: write # damit wir den VERSION-Commit pushen können
7+
contents: write # damit wir den VERSION-Commit pushen können
88

99
jobs:
1010
feature-build:
@@ -107,4 +107,3 @@ jobs:
107107
push: true
108108
tags: ${{ steps.metadata.outputs.tags }}
109109
labels: ${{ steps.metadata.outputs.labels }}
110-

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ branches:
99
feature:
1010
increment: Patch
1111
source-branches: [main]
12-
label: '{BranchName}'
12+
label: "{BranchName}"
1313
prevent-increment:
1414
of-merged-branch: true
1515
regex: ^feature/(?<BranchName>.+)$

0 commit comments

Comments
 (0)