forked from pypa/manylinux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: deploy with version like tags
- Loading branch information
Showing
1 changed file
with
22 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
#!/bin/bash | ||
tag="quay.io/pypa/${POLICY}_${PLATFORM}" | ||
build_id=$(git show -s --format=%cd-%h --date=short ${COMMIT_SHA}) | ||
|
||
set -euo pipefail | ||
|
||
export TZ=UTC0 | ||
|
||
TAG="quay.io/pypa/${POLICY}_${PLATFORM}" | ||
COMMIT_ABBREV_SHA=$(git show -s --format=%h ${COMMIT_SHA}) | ||
COMMIT_DATE=$(git show -s --format=%cd --date=short ${COMMIT_SHA}) | ||
BUILD_ID=${COMMIT_DATE}-${COMMIT_ABBREV_SHA} | ||
# Dependabot does not work with the BUILD_ID format | ||
# Use a version like tag | ||
if $(git rev-parse --is-shallow-repository); then | ||
git fetch --shallow-since=${COMMIT_DATE}T00:00:00Z | ||
fi | ||
BUILD_NUMBER=$(git rev-list --since=${COMMIT_DATE}T00:00:00Z --count ${COMMIT_SHA}) | ||
BUILD_ID2=${COMMIT_DATE//-/.}.${BUILD_NUMBER} | ||
|
||
docker login -u $QUAY_USERNAME -p $QUAY_PASSWORD quay.io | ||
docker tag ${tag}:${COMMIT_SHA} ${tag}:${build_id} | ||
docker tag ${tag}:${COMMIT_SHA} ${tag}:latest | ||
docker push ${tag}:${build_id} | ||
docker push ${tag}:latest | ||
docker tag ${TAG}:${COMMIT_SHA} ${TAG}:${BUILD_ID} | ||
docker tag ${TAG}:${COMMIT_SHA} ${TAG}:${BUILD_ID2} | ||
docker tag ${TAG}:${COMMIT_SHA} ${TAG}:latest | ||
docker push ${TAG}:${BUILD_ID} | ||
docker push ${TAG}:${BUILD_ID2} | ||
docker push ${TAG}:latest |