Skip to content

Commit 569fb52

Browse files
committed
add --dry-run option to deploy
1 parent 2febd75 commit 569fb52

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

.github/workflows/build.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919
paths:
2020
- ".github/workflows/build.yml"
2121
- "docker/**"
22-
- "build.sh"
22+
- "*.sh"
2323

2424
concurrency:
2525
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
@@ -68,8 +68,7 @@ jobs:
6868
run: ./build.sh
6969

7070
- name: Deploy
71-
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'pypa/manylinux'
72-
run: ./deploy.sh
71+
run: ./deploy.sh ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'pypa/manylinux') && '' || '--dry-run' }}
7372
env:
7473
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
7574
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}

deploy.sh

+13-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ set -euo pipefail
44

55
export TZ=UTC0
66

7+
DRY_RUN=0
8+
if [ "${1:-}" == "--dry-run" ]; then
9+
DRY_RUN=1
10+
set -x
11+
fi
12+
713
TAG="quay.io/pypa/${POLICY}_${PLATFORM}"
814
COMMIT_ABBREV_SHA=$(git show -s --format=%h ${COMMIT_SHA})
915
COMMIT_DATE=$(git show -s --format=%cd --date=short ${COMMIT_SHA})
@@ -16,10 +22,13 @@ fi
1622
BUILD_NUMBER=$(git rev-list --since=${COMMIT_DATE}T00:00:00Z --count ${COMMIT_SHA})
1723
BUILD_ID2=${COMMIT_DATE//-/.}.${BUILD_NUMBER}
1824

19-
docker login -u $QUAY_USERNAME -p $QUAY_PASSWORD quay.io
2025
docker tag ${TAG}:${COMMIT_SHA} ${TAG}:${BUILD_ID}
2126
docker tag ${TAG}:${COMMIT_SHA} ${TAG}:${BUILD_ID2}
2227
docker tag ${TAG}:${COMMIT_SHA} ${TAG}:latest
23-
docker push ${TAG}:${BUILD_ID}
24-
docker push ${TAG}:${BUILD_ID2}
25-
docker push ${TAG}:latest
28+
29+
if [ $DRY_RUN -eq 0 ]; then
30+
docker login -u $QUAY_USERNAME -p $QUAY_PASSWORD quay.io
31+
docker push ${TAG}:${BUILD_ID}
32+
docker push ${TAG}:${BUILD_ID2}
33+
docker push ${TAG}:latest
34+
fi

0 commit comments

Comments
 (0)