Skip to content

Commit 184b112

Browse files
authored
chore(ci): conditional dockerhub build env (#1103)
Use MIX_ENV=prod on version tags and MIX_ENV=dev for master
1 parent c8f498d commit 184b112

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/dockerhub.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,26 @@ on:
77
tags:
88
- v*
99

10+
env:
11+
MIX_ENV: dev
12+
1013
jobs:
1114
dockerhub:
1215
name: "Publish to Dockehub"
1316
runs-on: ubuntu-latest
17+
# Don't run on forks
18+
if: github.repository == 'aeternity/ae_mdw'
1419

1520
steps:
1621
- uses: actions/checkout@v3
1722
with:
1823
fetch-depth: 100
1924

25+
- name: Sets MIX_ENV to prod for release
26+
if: startsWith(github.ref, 'refs/tags/v')
27+
run: |
28+
echo "MIX_ENV=prod" >> $GITHUB_ENV
29+
2030
- name: Extract metadata for docker
2131
id: meta
2232
uses: docker/metadata-action@v4
@@ -26,7 +36,7 @@ jobs:
2636
type=raw,value=master,enable={{is_default_branch}}
2737
type=sha,prefix=,enable={{is_default_branch}}
2838
type=semver,pattern={{version}},enable={{is_default_branch}}
29-
39+
3040
- name: Login to Dockerhub
3141
uses: docker/login-action@v2
3242
with:
@@ -38,7 +48,7 @@ jobs:
3848
if: ${{ steps.meta.outputs.tags }}
3949
with:
4050
context: .
41-
build-args: MIX_ENV=prod
51+
build-args: MIX_ENV=${{env.MIX_ENV}}
4252
push: true
4353
tags: ${{ steps.meta.outputs.tags }}
4454
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)