@@ -155,6 +155,14 @@ jobs:
155
155
steps :
156
156
- name : Checkout
157
157
uses : actions/checkout@v2
158
+ - name : Set up Docker Buildx
159
+ uses : docker/setup-buildx-action@v1
160
+ - name : Login to GitHub Container Registry
161
+ uses : docker/login-action@v1
162
+ with :
163
+ registry : ${{ env.registry }}
164
+ username : ${{ github.repository_owner }}
165
+ password : ${{ secrets.CR_PAT }}
158
166
- name : Download frontend artifact
159
167
uses : actions/download-artifact@v2
160
168
with :
@@ -165,17 +173,33 @@ jobs:
165
173
with :
166
174
name : functions
167
175
path : images/artifacts
176
+ - name : Prepare
177
+ id : prep
178
+ run : |
179
+ VERSION=edge
180
+ if [[ $GITHUB_REF == refs/tags/* ]]; then
181
+ VERSION=${GITHUB_REF#refs/tags/}
182
+ elif [[ $GITHUB_REF == refs/heads/* ]]; then
183
+ VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
184
+ elif [[ $GITHUB_REF == refs/pull/* ]]; then
185
+ VERSION=pr-${{ github.event.number }}
186
+ fi
187
+ echo ::set-output name=version::${VERSION}
188
+ echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
168
189
- name : build image and push to GitHub Container Registry
169
- uses : docker/build-push-action@v1
190
+ uses : docker/build-push-action@v2
170
191
with :
171
- username : ${{ github.repository_owner }}
172
- password : ${{ secrets.CR_PAT }}
173
- repository : ${{ github.repository_owner }}/${{ env.image }}
174
- registry : ${{ env.registry }}
175
- tags : latest, ${{needs.Prepare.outputs.BRANCH}}-latest, ${{needs.Prepare.outputs.TAG_NAME}}
176
- tag_with_ref : true
177
- add_git_labels : true
178
- path : images
192
+ push : true
193
+ context : images
194
+ tags : |
195
+ ${{ env.registry }}/${{ github.repository_owner }}/${{ env.image }}:latest
196
+ ${{ env.registry }}/${{ github.repository_owner }}/${{ env.image }}:${{ steps.prep.outputs.version }}
197
+ ${{ env.registry }}/${{ github.repository_owner }}/${{ env.image }}:${{needs.Prepare.outputs.BRANCH}}-latest
198
+ ${{ env.registry }}/${{ github.repository_owner }}/${{ env.image }}:${{needs.Prepare.outputs.TAG_NAME}}
199
+ labels : |
200
+ org.opencontainers.image.source=${{ github.event.repository.html_url }}
201
+ org.opencontainers.image.created=${{ steps.prep.outputs.created }}
202
+ org.opencontainers.image.revision=${{ github.sha }}
179
203
180
204
DeployPush :
181
205
name : Deploy functions container from Push
0 commit comments