-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (62 loc) · 2.47 KB
/
publish-snapshot.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Publish Snapshot (DEV Version)
on:
push:
branches: [ main ]
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
RUN_REGION: europe-west1
jobs:
publish-snapshot:
runs-on: ubuntu-latest
steps:
- name: Check out sources...
uses: actions/checkout@v3
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
cache: 'gradle'
- name: Verify
run: ./gradlew test --no-daemon
- name: Update Parameters
run: |
NOW=$(TZ=GMT date +"%Y-%m-%d %H:%M:%SZ")
YEAR=$(TZ=GMT date +"%Y")
SPEC_VERSION=2.x
VERSION=${SPEC_VERSION}.${GITHUB_RUN_NUMBER}-SNAPSHOT-${GITHUB_SHA:0:7}
sed -i "s|@@branch@@|${GITHUB_REF#refs/heads/}|g" *.xsd
sed -i "s|@@version@@|${VERSION}|g" *.xsd
sed -i "s|@@year@@|${YEAR}|g" *.xsd
sed -i "s|@@buildTime@@|${NOW}|g" *.xsd
echo "{ \"buildTime\": \"${NOW}\", \"version\": \"${VERSION}\", \"specVersion\": \"${SPEC_VERSION}\" }" > version.json
- name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: Setup GCloud CLI
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ inputs.GCP_PROJECT_ID }}
- name: Copy files to GCloud Bucket
run: |
gsutil cp ./*.xsd gs://schema.cip4.org/jdfschema_2_x/
gsutil cp ./version.json gs://schema.cip4.org/jdfschema_2_x/
- name: Create ZIP Archive
run: zip jdfschema_2_x.zip *.xsd version.json LICENSE.md
- name: Copy ZIP Archive to GCloud Bucket
run: gsutil cp ./*.zip gs://schema.cip4.org/
- name: Createa tar.gz Archive
run: tar -czvf jdfschema_2_x.tar.gz *.xsd version.json LICENSE.md
- name: Copy tar.gz Archive to GCloud Bucket
run: gsutil cp ./*.tar.gz gs://schema.cip4.org/
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: xsd-artifact
path: xjdf.xsd
- name: Invalidate CDN Cache
run: |
gcloud compute url-maps invalidate-cdn-cache cip4-public-balancer --path "/jdfschema_2_x/*"
gcloud compute url-maps invalidate-cdn-cache cip4-public-balancer --path "/jdfschema_2_x.zip"
gcloud compute url-maps invalidate-cdn-cache cip4-public-balancer --path "/jdfschema_2_x.tar.gz"