Skip to content

Commit 79c63ed

Browse files
committed
Calculate datetime in the beginning of deployment procedure
1 parent e309695 commit 79c63ed

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

.github/actions/build-debian-packages/action.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
name: 'Build debian packages for Cuttlefish host'
22
inputs:
3-
deploy-channel:
3+
yyyymmddhhmm:
44
required: false
55
runs:
66
using: "composite"
77
steps:
8-
- name: Modify version for unstable/nightly channel
9-
if: inputs.deploy-channel != 'stable'
8+
- name: Modify version with datetime
9+
if: inputs.yyyymmddhhmm != ''
1010
run: |
1111
# Modify debian/changelog to build debian package with desired version
1212
# format.
1313
# Stable version format : X.Y.Z
1414
# Unstable/nightly version format : X.Y.Z~gitYYYYMMDDHHMM.<Github SHA 8 digit>
15-
DATETIME=$(date -u +'%Y%m%d%H%M')
1615
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
17-
SUFFIX="~git${DATETIME}.${SHORT_SHA}"
16+
SUFFIX="~git${{ inputs.yyyymmddhhmm }}.${SHORT_SHA}"
1817
sed -i "1s/(\([0-9]\+.[0-9]\+.[0-9]\+\))/(\1${SUFFIX})/g" \
1918
base/debian/changelog
2019
sed -i "1s/(\([0-9]\+.[0-9]\+.[0-9]\+\))/(\1${SUFFIX})/g" \

.github/actions/deploy-docker-image/action.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ inputs:
44
required: true
55
deploy-channel:
66
required: true
7+
yyyymmddhhmm:
8+
required: false
79
runs:
810
using: "composite"
911
steps:
@@ -23,9 +25,8 @@ runs:
2325
;;
2426
nightly)
2527
# Nightly version tag : gitYYYYMMDDHHMM-<Github SHA 8 digit>-<amd64|arm64>
26-
DATE=$(date -u +'%Y%m%d%H%M')
2728
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
28-
TAG="git${DATE}-${SHORT_SHA}-${{ inputs.arch }}"
29+
TAG="git${{ inputs.yyyymmddhhmm }}-${SHORT_SHA}-${{ inputs.arch }}"
2930
;;
3031
*)
3132
exit 1

.github/workflows/update-cache-and-deployment.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ on:
1414
required: true
1515

1616
jobs:
17+
set-github-env:
18+
runs-on: ubuntu-22.04
19+
steps:
20+
- name: Set YYYYMMDDHHMM
21+
run: echo "YYYYMMDDHHMM=$(date -u +'%Y%m%d%H%M')" >> $GITHUB_ENV
1722
update-cvd-test-bazel-cache:
1823
if: inputs.update-cache
1924
runs-on: ubuntu-24.04
@@ -33,6 +38,7 @@ jobs:
3338
- name: Run cvd unit tests
3439
uses: ./.github/actions/run-cvd-unit-tests
3540
update-bazel-cache-and-deploy-debian-package-amd64:
41+
needs: [set-github-env]
3642
environment: deployment
3743
runs-on: ubuntu-22.04
3844
steps:
@@ -51,7 +57,7 @@ jobs:
5157
- name: Build CF host debian packages
5258
uses: ./.github/actions/build-debian-packages
5359
with:
54-
deploy-channel: ${{ inputs.deploy-channel }}
60+
yyyymmddhhmm: ${{ env.YYYYMMDDHHMM }}
5561
- name: Authentication on GCP project android-cuttlefish-artifacts
5662
if: inputs.deploy-channel != ''
5763
uses: 'google-github-actions/auth@v2'
@@ -64,6 +70,7 @@ jobs:
6470
deploy-channel: ${{ inputs.deploy-channel }}
6571
path: .
6672
update-bazel-cache-and-deploy-debian-package-arm64:
73+
needs: [set-github-env]
6774
environment: deployment
6875
runs-on: ubuntu-22.04-arm
6976
steps:
@@ -82,7 +89,7 @@ jobs:
8289
- name: Build CF host debian packages
8390
uses: ./.github/actions/build-debian-packages
8491
with:
85-
deploy-channel: ${{ inputs.deploy-channel }}
92+
yyyymmddhhmm: ${{ env.YYYYMMDDHHMM }}
8693
- name: Authentication on GCP project android-cuttlefish-artifacts
8794
if: inputs.deploy-channel != ''
8895
uses: 'google-github-actions/auth@v2'
@@ -120,6 +127,7 @@ jobs:
120127
with:
121128
arch: amd64
122129
deploy-channel: ${{ inputs.deploy-channel }}
130+
yyyymmddhhmm: ${{ env.YYYYMMDDHHMM }}
123131
deploy-docker-image-arm64:
124132
if: inputs.deploy-channel != ''
125133
needs: [update-bazel-cache-and-deploy-debian-package-arm64]
@@ -145,6 +153,7 @@ jobs:
145153
with:
146154
arch: arm64
147155
deploy-channel: ${{ inputs.deploy-channel }}
156+
yyyymmddhhmm: ${{ env.YYYYMMDDHHMM }}
148157
deploy-docker-manifest:
149158
if: inputs.deploy-channel != ''
150159
needs: [deploy-docker-image-amd64, deploy-docker-image-arm64]
@@ -179,9 +188,8 @@ jobs:
179188
;;
180189
nightly)
181190
# Nightly version tag : gitYYYYMMDDHHMM-<Github SHA 8 digit>
182-
DATE=$(date -u +'%Y%m%d%H%M')
183191
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
184-
TAG="git${DATE}-${SHORT_SHA}"
192+
TAG="git${{ env.YYYYMMDDHHMM }}-${SHORT_SHA}"
185193
;;
186194
*)
187195
exit 1

0 commit comments

Comments
 (0)