Skip to content

Commit 172badc

Browse files
committed
Fix stable version format for deployment
1 parent d6a4a04 commit 172badc

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

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

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,37 @@
11
name: 'Build debian packages for Cuttlefish host'
22
inputs:
3+
deploy-channel:
4+
required: false
35
yyyymmddhhmm:
46
required: false
57
runs:
68
using: "composite"
79
steps:
8-
- name: Modify version with datetime
9-
if: inputs.yyyymmddhhmm != ''
10+
- name: Modify version format
11+
if: inputs.deploy-channel != ''
1012
run: |
11-
# Modify debian/changelog to build debian package with desired version
12-
# format.
13-
# Stable version format : X.Y.Z
14-
# Unstable/nightly version format : X.Y.Z~gitYYYYMMDDHHMM.<Github SHA 8 digit>
15-
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
16-
SUFFIX="~git${{ inputs.yyyymmddhhmm }}.${SHORT_SHA}"
17-
sed -i "1s/(\([0-9]\+.[0-9]\+.[0-9]\+\))/(\1${SUFFIX})/g" \
18-
base/debian/changelog
19-
sed -i "1s/(\([0-9]\+.[0-9]\+.[0-9]\+\))/(\1${SUFFIX})/g" \
20-
frontend/debian/changelog
13+
case "${{ inputs.deploy-channel }}" in
14+
stable)
15+
# Stable version format : X.Y.Z
16+
SEMVER=$(echo ${{ github.ref_name }} | grep -oE '[0-9]+.[0-9]+.[0-9]+')
17+
sed -i "1s/(\([0-9]\+.[0-9]\+.[0-9]\+\))/(${SEMVER})/g" \
18+
base/debian/changelog
19+
sed -i "1s/(\([0-9]\+.[0-9]\+.[0-9]\+\))/(${SEMVER})/g" \
20+
frontend/debian/changelog
21+
;;
22+
unstable|nightly)
23+
# Unstable/nightly version format : X.Y.Z~gitYYYYMMDDHHMM.<Github SHA 8 digit>
24+
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
25+
SUFFIX="~git${{ inputs.yyyymmddhhmm }}.${SHORT_SHA}"
26+
sed -i "1s/(\([0-9]\+.[0-9]\+.[0-9]\+\))/(\1${SUFFIX})/g" \
27+
base/debian/changelog
28+
sed -i "1s/(\([0-9]\+.[0-9]\+.[0-9]\+\))/(\1${SUFFIX})/g" \
29+
frontend/debian/changelog
30+
;;
31+
*)
32+
exit 1
33+
;;
34+
esac
2135
shell: bash
2236
- name: Build CF debian packages
2337
run: |

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
- name: Build CF host debian packages
6363
uses: ./.github/actions/build-debian-packages
6464
with:
65+
deploy-channel: ${{ inputs.deploy-channel }}
6566
yyyymmddhhmm: ${{ needs.set-variables.outputs.yyyymmddhhmm }}
6667
- name: Authentication on GCP project android-cuttlefish-artifacts
6768
if: inputs.deploy-channel != ''
@@ -94,6 +95,7 @@ jobs:
9495
- name: Build CF host debian packages
9596
uses: ./.github/actions/build-debian-packages
9697
with:
98+
deploy-channel: ${{ inputs.deploy-channel }}
9799
yyyymmddhhmm: ${{ needs.set-variables.outputs.yyyymmddhhmm }}
98100
- name: Authentication on GCP project android-cuttlefish-artifacts
99101
if: inputs.deploy-channel != ''

0 commit comments

Comments
 (0)