-
Notifications
You must be signed in to change notification settings - Fork 142
35 lines (33 loc) · 1.45 KB
/
test_gcs_access.yml
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
on:
push:
branches:
- '**'
jobs:
test_gcs:
name: Test Google Cloud Storage access
runs-on: ubuntu-latest
env:
GCLOUD_VERSION: 458.0.1-linux-x86_64
BUCKET: docs-prod-learn-redis-com
BUCKET_SERVICE_ACCOUNT: ${{ secrets.BUCKET_DOCUMENTATION_SA_PROD }}
BUCKET_SECRET: ${{ secrets.BUCKET_DOCUMENTATION_PROD }}
GCP_PROJECT: ${{ secrets.GCP_PROJECT_PROD }}
steps:
- uses: actions/checkout@v4
- name: Start
run: echo "The name of the branch is ${{ github.ref }} on ${{ github.repository }}"
- name: Fetch the credentails
run: echo $BUCKET_SECRET | base64 --decode > service_account.json && ls -a service_account.json
- name: Install the Google Cloud CLI
run: |
wget -O ${{ github.workspace }}/google-cloud-cli.tar.gz "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-$GCLOUD_VERSION.tar.gz" \
&& tar -xvf google-cloud-cli.tar.gz -C ${{ github.workspace }}\
&& ${{ github.workspace }}/google-cloud-sdk/install.sh --quiet
- name: Authenticate to Google Cloud
run: |
./google-cloud-sdk/bin/gcloud auth activate-service-account $BUCKET_SERVICE_ACCOUNT --key-file=./service_account.json --project=$GCP_PROJECT \
&& ./google-cloud-sdk/bin/gcloud auth list
- name: List files
run: ./google-cloud-sdk/bin/gsutil ls gs://$BUCKET
- name: End
run: echo "This job's status is ${{ job.status }}."