File tree 3 files changed +23
-12
lines changed
3 files changed +23
-12
lines changed Original file line number Diff line number Diff line change 43
43
with :
44
44
file : Dockerfile
45
45
build-args : |
46
- BUILD_REPO=$GITHUB_REPOSITORY
47
- BUILD_REF=$GITHUB_REF_NAME
48
- BUILD_COMMIT=$GITHUB_SHA
46
+ GITHUB_REF_NAME=${{ github.ref_name }}
47
+ GITHUB_REPOSITORY=${{ github.repository }}
48
+ GITHUB_REPOSITORY_URL=${{ github.repositoryUrl }}
49
+ GITHUB_SHA=${{ github.sha }}
49
50
target : app
50
51
tags : |
51
52
${{ inputs.registry }}/ptime/${{ inputs.project_name }}:latest
Original file line number Diff line number Diff line change @@ -28,13 +28,17 @@ ARG RAILS_HOST_NAME="unused.example.net"
28
28
ARG SECRET_KEY_BASE="needs-to-be-set"
29
29
ARG RAILS_DB_ADAPTER="nulldb"
30
30
31
+ # If you want to directly specify build infos
32
+ ARG BUILD_COMMIT
33
+ ARG BUILD_REPO
34
+ ARG BUILD_REPO_URL
35
+ ARG BUILD_REF
36
+
31
37
# Github specific
32
38
ARG GITHUB_SHA
33
39
ARG GITHUB_REPOSITORY
40
+ ARG GITHUB_REPOSITORY_URL
34
41
ARG GITHUB_REF_NAME
35
- ARG BUILD_COMMIT="$GITHUB_SHA"
36
- ARG BUILD_REPO="$GITHUB_REPOSITORY"
37
- ARG BUILD_REF="$GITHUB_REF_NAME"
38
42
39
43
# # Gitlab specific
40
44
# ARG CI_COMMIT_SHA
@@ -158,18 +162,24 @@ ARG RAILS_ENV
158
162
# data persisted in the image
159
163
ARG PS1
160
164
ARG TZ
165
+ ARG GITHUB_SHA
166
+ ARG GITHUB_REPOSITORY
167
+ ARG GITHUB_REPOSITORY_URL
168
+ ARG GITHUB_REF_NAME
161
169
ARG BUILD_COMMIT
162
170
ARG BUILD_REPO
171
+ ARG BUILD_REPO_URL
163
172
ARG BUILD_REF
164
173
165
174
# Custom ARGs
166
175
ARG SKIP_MEMCACHE_CHECK
167
176
168
177
ENV PS1="${PS1}" \
169
178
TZ="${TZ}" \
170
- BUILD_REPO="${BUILD_REPO}" \
171
- BUILD_REF="${BUILD_REF}" \
172
- BUILD_COMMIT="${BUILD_COMMIT}" \
179
+ BUILD_REPO="${BUILD_REPO:-${GITHUB_REPOSITORY}}" \
180
+ BUILD_REPO_URL="${BUILD_REPO_URL:-${GITHUB_REPOSITORY_URL}}" \
181
+ BUILD_REF="${BUILD_REF:-${GITHUB_REF_NAME}}" \
182
+ BUILD_COMMIT="${BUILD_COMMIT:-${GITHUB_SHA}}" \
173
183
RAILS_ENV="${RAILS_ENV}" \
174
184
RACK_ENV="${RACK_ENV}"
175
185
Original file line number Diff line number Diff line change @@ -98,10 +98,10 @@ def self.build_version
98
98
end
99
99
100
100
def self . commit_hash ( short : false )
101
- return unless File . exist? ( Rails . root . join ( 'BUILD_INFO' ) . to_s )
101
+ return unless ENV [ 'BUILD_COMMIT' ]
102
102
103
- commit = File . open ( Rails . root . join ( 'BUILD_INFO' ) . to_s ) . first . chomp
104
- return commit . first ( 7 ) if short
103
+ commit = ENV [ 'BUILD_COMMIT' ] . chomp
104
+ return commit . first ( 8 ) if short
105
105
106
106
commit
107
107
end
You can’t perform that action at this time.
0 commit comments