-
Notifications
You must be signed in to change notification settings - Fork 42
54 lines (46 loc) · 1.66 KB
/
sidecar-mac.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Sidecar build for mac
on:
workflow_dispatch:
jobs:
build:
runs-on: macos-latest # Run this job on a macOS environment
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Build
run: |
cargo build --release
# Install gcp skcd
- name: Setup GCP SDK
uses: 'google-github-actions/setup-gcloud@v0'
with:
project_id: '${{ env.GCP_PROJECT_ID }}'
service_account_key: '${{ secrets.GCP_SA_KEY }}'
# Setup auth for gcp
- name: GPC Auth
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GCP_GAE_SA_KEY }}'
# Now run the .sh script which does the building and packaging
- name: Build and package
run: |
./package.sh
- name: Upload to GCP bucket generated zip file
env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_BUCKET_NAME: ${{ secrets.GCP_BUCKET_NAME }}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
run: |
# Decode the GCP_SA_KEY secret and write the contents to a temporary file
echo "$GCP_SA_KEY" | base64 --decode > gcp_sa_key.json
# Authenticate to gcloud with the service account key
gcloud auth activate-service-account --key-file=gcp_sa_key.json
# Set your GCP project
gcloud config set project $GCP_PROJECT_ID
# Copy the built binary to the GCP bucket
gsutil cp sidecar.zip gs://sidecar-bin/mac/sidecar.zip
# Remove the service account key file
rm gcp_sa_key.json