Skip to content

Commit 5b3c8e6

Browse files
committed
change to build-push-action@v2
1 parent d782bd5 commit 5b3c8e6

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

.github/workflows/build_push.yml

+33-9
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ jobs:
155155
steps:
156156
- name: Checkout
157157
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 }}
158166
- name: Download frontend artifact
159167
uses: actions/download-artifact@v2
160168
with:
@@ -165,17 +173,33 @@ jobs:
165173
with:
166174
name: functions
167175
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')
168189
- name: build image and push to GitHub Container Registry
169-
uses: docker/build-push-action@v1
190+
uses: docker/build-push-action@v2
170191
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 }}
179203
180204
DeployPush:
181205
name: Deploy functions container from Push

0 commit comments

Comments
 (0)