Skip to content

Commit f233f91

Browse files
committed
Fix for docker build.
1 parent 2ef6021 commit f233f91

1 file changed

Lines changed: 27 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
CONFIGURATION: Release
1919

2020
jobs:
21-
build:
21+
build-windows:
2222
name: Build Papercut SMTP
2323
runs-on: windows-2022
2424
permissions:
@@ -85,19 +85,42 @@ jobs:
8585
env:
8686
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8787

88+
build-docker:
89+
name: Build and Push Docker Image
90+
runs-on: ubuntu-latest
91+
needs: build-windows
92+
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push'
93+
permissions:
94+
contents: read
95+
packages: write
96+
97+
steps:
98+
- name: Checkout code
99+
uses: actions/checkout@v4
100+
with:
101+
fetch-depth: 0
102+
103+
- name: Install GitVersion
104+
uses: gittools/actions/gitversion/setup@v4.1.0
105+
with:
106+
versionSpec: '6.x'
107+
108+
- name: Determine Version
109+
id: gitversion
110+
uses: gittools/actions/gitversion/execute@v4.1.0
111+
with:
112+
configFilePath: GitVersion.yml
113+
88114
- name: Set up Docker Buildx
89-
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push'
90115
uses: docker/setup-buildx-action@v3
91116

92117
- name: Log in to Docker Hub
93-
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push'
94118
uses: docker/login-action@v3
95119
with:
96120
username: ${{ secrets.DOCKER_USERNAME }}
97121
password: ${{ secrets.DOCKER_PASSWORD }}
98122

99123
- name: Extract Docker metadata
100-
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push'
101124
id: meta
102125
uses: docker/metadata-action@v5
103126
with:
@@ -110,7 +133,6 @@ jobs:
110133
type=semver,pattern={{major}}.{{minor}},value=${{ steps.gitversion.outputs.semVer }},enable=${{ github.ref == 'refs/heads/master' }}
111134
112135
- name: Build and push Docker image
113-
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push'
114136
uses: docker/build-push-action@v5
115137
with:
116138
context: .

0 commit comments

Comments
 (0)