Skip to content

Commit 030713b

Browse files
committed
trying to get pull requests to main into operation
1 parent e8f2282 commit 030713b

2 files changed

Lines changed: 50 additions & 16 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,28 @@ permissions:
1010

1111
jobs:
1212

13+
env:
14+
GIT_USER_NAME: GitHub Pipeline
15+
GIT_USER_EMAIL: github_pipeline@fairagro.net
16+
IMAGE_NAME: zalf/fairagro_advanced_middleware_api
17+
1318
determine-version:
1419
runs-on: ubuntu-latest
1520

1621
permissions:
1722
contents: write
1823

1924
outputs:
20-
SemVer: ${{ steps.gitversion.outputs.SemVer }}
25+
SemVer: ${{ steps.gitversion.outputs.SemVer }}
26+
Major: ${{ steps.gitversion.outputs.Major }}
27+
Minor: ${{ steps.gitversion.outputs.Minor }}
28+
Patch: ${{ steps.gitversion.outputs.Patch }}
2129

2230
steps:
2331
- name: Checkout repo
2432
uses: actions/checkout@v5
2533
with:
34+
ref: ${{ github.ref }}
2635
fetch-depth: 0
2736

2837
# Prüfen des Labels für Version Bump
@@ -44,24 +53,36 @@ jobs:
4453
}
4554
4655
# GitVersion für main Merge
47-
- name: Run GitVersion
56+
- name: Install GitVersion
57+
uses: gittools/actions/gitversion/setup@v4
58+
with:
59+
versionSpec: 6.x
60+
61+
- name: Execute GitVersion
4862
id: gitversion
49-
uses: gittools/actions/gitversion/execute@v3
63+
uses: gittools/actions/gitversion/execute@v4
5064
with:
51-
versionSpec: 5.x
52-
updateAssemblyInfo: false
53-
showVariable: SemVer
65+
configFilePath: GitVersion.yml
5466
increment: ${{ steps.version-bump.outputs.bump }}
5567

5668
- name: Show calculated version
5769
run: 'echo "Calculated Version: ${{ steps.gitversion.outputs.SemVer }}"'
5870

59-
- name: Tag Version
71+
- name: Show computed feature version
72+
run: |
73+
echo "FullSemVer: ${{ steps.gitversion.outputs.FullSemVer }}"
74+
echo "SemVer: ${{ steps.gitversion.outputs.SemVer }}"
75+
echo "PreRelease: ${{ steps.gitversion.outputs.PreReleaseTag }}"
76+
77+
- name: Create git tag
6078
run: |
61-
git config --global user.email "github_actions@company.com"
62-
git config --global user.name "GitHub Actions"
63-
git tag -a "v${{ steps.gitversion.outputs.SemVer }}" -m "Release ${{ steps.gitversion.outputs.SemVer }}"
64-
git push origin "v${{ steps.gitversion.outputs.SemVer }}"
79+
VERSION="${{ steps.gitversion.outputs.SemVer }}"
80+
git config user.name "${{ env.GIT_USER_NAME }}"
81+
git config user.email "{{ env.GIT_USER_EMAIL }}"
82+
git tag -a "v${VERSION}" -m "release $VERSION"
83+
git push origin "v${VERSION}"
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6586

6687
docker-build-main:
6788
runs-on: ubuntu-latest
@@ -70,6 +91,8 @@ jobs:
7091
steps:
7192
- name: Checkout repo
7293
uses: actions/checkout@v5
94+
with:
95+
ref: ${{ github.ref }}
7396

7497
- name: Set up Docker Buildx
7598
uses: docker/setup-buildx-action@v3
@@ -78,19 +101,30 @@ jobs:
78101
id: metadata
79102
uses: docker/metadata-action@v5
80103
with:
81-
images: myorg/middleware
82-
tags: v${{ needs.determine-version.outputs.SemVer }}
104+
images: ${{ env.IMAGE_NAME }}
105+
tags: |
106+
type=semver,pattern={{version}},value=${{ needs.version.outputs.SemVer }}
107+
type=raw,value=${{ needs.version.outputs.Major }}.${{ needs.version.outputs.Minor }}
108+
type=raw,value=${{ needs.version.outputs.Major }}
109+
110+
# Secrets are managed within the github GUI
111+
- name: Log in to Docker Hub
112+
uses: docker/login-action@v3
113+
with:
114+
username: ${{ secrets.DOCKERHUB_USER }}
115+
password: ${{ secrets.DOCKERHUB_TOKEN }}
83116

84117
- name: Build & Push Docker Image
85118
uses: docker/build-push-action@v6
86119
with:
87120
push: true
88121
tags: ${{ steps.metadata.outputs.tags }}
89-
build-args: python_version=3.12
122+
labels: ${{ steps.metadata.outputs.labels }}
90123

91124
create-release:
92125
runs-on: ubuntu-latest
93126
needs: docker-build-main
127+
94128
permissions:
95129
contents: write
96130

@@ -101,6 +135,6 @@ jobs:
101135
tag: v${{ needs.determine-version.outputs.SemVer }}
102136
name: "Release v${{ needs.determine-version.outputs.SemVer }}"
103137
body: |
104-
Docker image: `myorg/middleware:v${{ needs.determine-version.outputs.SemVer }}`
138+
Docker image: `${{ env.IMAGE_NAME }}:v${{ needs.determine-version.outputs.SemVer }}`
105139
draft: false
106140
prerelease: false

.github/workflows/feature-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
git config user.name "${{ env.GIT_USER_NAME }}"
6767
git config user.email "{{ env.GIT_USER_EMAIL }}"
6868
git tag -a "v${VERSION}" -m "pre-release $VERSION"
69-
git push origin HEAD:${GITHUB_REF#refs/heads/}
69+
git push origin "v${VERSION}"
7070
env:
7171
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7272

0 commit comments

Comments
 (0)