Skip to content

Commit 0a7c3b3

Browse files
committed
Deploy nightly version of CF host debian packages into AR
1 parent 3a7a4d9 commit 0a7c3b3

File tree

3 files changed

+65
-3
lines changed

3 files changed

+65
-3
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@ inputs:
55
runs:
66
using: "composite"
77
steps:
8+
- name: Setup nightly version
9+
run: |
10+
# TODO(b/440196950): Setup condition on this step when we build
11+
# stable/unstable versions here too.
12+
13+
# Modify debian/changelog to build debian package with desired version
14+
# format.
15+
# Stable/Unstable version format : X.Y.Z
16+
# Nightly version format : X.Y.Z~gitYYYYMMDD.<Github SHA 8 digit>
17+
DATE=$(date -u +'%Y%m%d')
18+
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
19+
SUFFIX="~git${DATE}.${SHORT_SHA}"
20+
sed -i "1s/(\([0-9]\+.[0-9]\+.[0-9]\+\))/(\1${SUFFIX})/g" \
21+
base/debian/changelog
22+
sed -i "1s/(\([0-9]\+.[0-9]\+.[0-9]\+\))/(\1${SUFFIX})/g" \
23+
frontend/debian/changelog
24+
shell: bash
825
- name: Build CF debian packages
926
run: |
1027
sudo docker build --file "tools/buildutils/cw/Containerfile" --tag "android-cuttlefish-build" .
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: 'Deploy debian packages for Cuttlefish host'
2+
inputs:
3+
path:
4+
required: true
5+
runs:
6+
using: "composite"
7+
steps:
8+
- name: 'Set up Cloud SDK'
9+
uses: 'google-github-actions/[email protected]'
10+
with:
11+
version: '>= 363.0.0'
12+
- name: Deploy deb packages into Artifact Registry
13+
run: |
14+
pushd ${{ inputs.path }}
15+
for var in base user orchestration; do
16+
gcloud --project=android-cuttlefish-artifacts \
17+
artifacts apt upload \
18+
android-cuttlefish-nightly \
19+
--location=us \
20+
--source=$(find . -name cuttlefish-${var}_*.deb)
21+
done
22+
popd
23+
shell: bash

.github/workflows/update-bazel-cache.yaml renamed to .github/workflows/update-cache-and-deployment.yaml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Update Bazel Cache
1+
name: Update bazel cache and deploy artifacts
22

33
on:
44
push:
@@ -29,8 +29,9 @@ jobs:
2929
uses: ./.github/actions/run-cvd-unit-tests
3030
with:
3131
cache-path: "$HOME/bazel-disk-cache"
32-
update-debian-package-amd64-bazel-cache:
32+
update-bazel-cache-and-deploy-debian-package-amd64:
3333
if: ${{ github.repository_owner == 'google' }}
34+
environment: deployment
3435
runs-on: ubuntu-22.04
3536
steps:
3637
- name: Free disk space
@@ -50,8 +51,19 @@ jobs:
5051
uses: ./.github/actions/build-debian-packages
5152
with:
5253
cache-path: "$HOME/bazel-disk-cache"
53-
update-debian-package-arm64-bazel-cache:
54+
- name: Authentication on GCP project android-cuttlefish-artifacts
55+
if: github.event_name == 'push'
56+
uses: 'google-github-actions/auth@v2'
57+
with:
58+
credentials_json: '${{ secrets.ARTIFACT_REGISTRY_UPLOADER }}'
59+
- name: Deploy CF host debian packages
60+
if: github.event_name == 'push'
61+
uses: ./.github/actions/deploy-debian-packages
62+
with:
63+
path: .
64+
update-bazel-cache-and-deploy-debian-package-arm64:
5465
if: ${{ github.repository_owner == 'google' }}
66+
environment: deployment
5567
runs-on: ubuntu-22.04-arm
5668
steps:
5769
- name: Free disk space
@@ -71,3 +83,13 @@ jobs:
7183
uses: ./.github/actions/build-debian-packages
7284
with:
7385
cache-path: "$HOME/bazel-disk-cache"
86+
- name: Authentication on GCP project android-cuttlefish-artifacts
87+
if: github.event_name == 'push'
88+
uses: 'google-github-actions/auth@v2'
89+
with:
90+
credentials_json: '${{ secrets.ARTIFACT_REGISTRY_UPLOADER }}'
91+
- name: Deploy CF host debian packages
92+
if: github.event_name == 'push'
93+
uses: ./.github/actions/deploy-debian-packages
94+
with:
95+
path: .

0 commit comments

Comments
 (0)