-
Notifications
You must be signed in to change notification settings - Fork 21
53 lines (46 loc) · 1.61 KB
/
cloud-storage-build-and-push.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
name: Build and Push uber-jar to Google Cloud Storage
on:
# This allows manual activation of this action for testing.
workflow_dispatch:
push:
tags:
# Automatically build and push Docker image when a release (version) tag is pushed.
- v*
env:
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
jobs:
setup-build-publish-deploy:
name: Setup, Build, and Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.CLOUD_SPANNER_PG_ADAPTER_SERVICE_ACCOUNT }}'
# Build the uber-jar
- name: Build
run: |
mvn package -Pshade -DskipTests
export VERSION=`echo $GITHUB_REF | awk -F/ '{print $NF}'`
echo $VERSION
cp "target/pgadapter.jar" "target/pgadapter-$VERSION.jar"
echo "uber_jar=target/pgadapter-$VERSION.jar" >> $GITHUB_ENV
echo "uber_jar_current=target/pgadapter.jar" >> $GITHUB_ENV
echo ${{ env.uber_jar }}
echo ${{ env.uber_jar_current }}
# Upload the jar to Google Cloud Storage
- id: 'upload-versioned-file'
uses: 'google-github-actions/upload-cloud-storage@v1'
with:
path: ${{ env.uber_jar }}
destination: 'pgadapter-jar-releases'
parent: false
- id: 'overwrite-current-file'
uses: 'google-github-actions/upload-cloud-storage@v1'
with:
path: ${{ env.uber_jar_current }}
destination: 'pgadapter-jar-releases'
parent: false