-
Notifications
You must be signed in to change notification settings - Fork 21
56 lines (48 loc) · 1.74 KB
/
cloud-storage-build-and-push-assembly.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
55
56
name: Build and Push assembly 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@v2'
with:
credentials_json: '${{ secrets.CLOUD_SPANNER_PG_ADAPTER_SERVICE_ACCOUNT }}'
# Build the assembly
- name: Build assembly
run: |
mvn package -Passembly -DskipTests
export VERSION=`echo $GITHUB_REF | awk -F/ '{print $NF}'`
echo $VERSION
cd "target/pgadapter"
tar -czvf pgadapter.tar.gz pgadapter.jar lib
cp "pgadapter.tar.gz" "pgadapter-$VERSION.tar.gz"
echo "assembly=target/pgadapter/pgadapter-$VERSION.tar.gz" >> $GITHUB_ENV
echo "assembly_current=target/pgadapter/pgadapter.tar.gz" >> $GITHUB_ENV
echo ${{ env.assembly }}
echo ${{ env.assembly_current }}
# Upload the assembly to Google Cloud Storage
- id: 'upload-versioned-file'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: ${{ env.assembly }}
destination: 'pgadapter-jar-releases'
parent: false
- id: 'overwrite-current-file'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: ${{ env.assembly_current }}
destination: 'pgadapter-jar-releases'
parent: false