-
Notifications
You must be signed in to change notification settings - Fork 8
102 lines (82 loc) · 3.67 KB
/
release.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Release
on:
push:
tags:
- '*'
env:
# GCS_BUCKET is the name of the Google Cloud Storage bucket to which all artifacts are deployed.
GCS_BUCKET: mitbattlecode-releases
# RELEASE_ARTIFACT_ID is the name of the Maven artifact produced by the buildsystem.
# Important: you must make sure no ID is a prefix of a different ID. Otherwise, you could
# inadvertently cause unintended episodes to become public.
RELEASE_ARTIFACT_ID: battlecode22
# IS_PUBLIC is whether to release deployments publicly. Set to exactly the text "YES" to do so.
IS_PUBLIC: YES
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Get release version
run: |
release_version=${GITHUB_REF#refs/*/}
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
echo "The release version is $release_version"
- name: Authenticate to Google Cloud Platform
uses: google-github-actions/auth@v1
with:
create_credentials_file: true
workload_identity_provider: projects/830784087321/locations/global/workloadIdentityPools/releases/providers/github-workflow
service_account: [email protected]
- name: Set up Google Cloud SDK
uses: 'google-github-actions/setup-gcloud@v1'
- name: Set up Wine # See actions/runner-images#743
run: |
sudo dpkg --add-architecture i386
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo add-apt-repository ppa:cybermax-dexter/sdl2-backport
sudo apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu $(lsb_release -cs) main"
sudo apt install --install-recommends winehq-stable
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: adopt
- name: Set up Node 16
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install schema
run: npm install
working-directory: ./schema
- name: Install client
run: npm run install-all
working-directory: ./client
- name: Publish to local repository
run: ./gradlew publishToMavenLocal -Prelease_version=$RELEASE_VERSION
- name: Build web client
run: npm run prod
working-directory: ./client/visualizer
- name: Determine access control
run: |
[[ "$IS_PUBLIC" = "YES" ]] && acl="public-read" || acl="project-private"
echo "OBJECT_ACL=$acl" >> $GITHUB_ENV
echo "Objects will be uploaded with ACL $acl"
- name: Upload maven artifacts to remote repository
run: gsutil -m rsync -a $OBJECT_ACL -r $HOME/.m2/repository/org/battlecode gs://$GCS_BUCKET/maven/org/battlecode
- name: Upload javadocs
run: |
unzip -d ${{ runner.temp }}/javadoc $HOME/.m2/repository/org/battlecode/$RELEASE_ARTIFACT_ID/$RELEASE_VERSION/*-javadoc.jar
gsutil -m rsync -a $OBJECT_ACL -r ${{ runner.temp }}/javadoc gs://$GCS_BUCKET/javadoc/$RELEASE_ARTIFACT_ID/$RELEASE_VERSION
- name: Upload specs
run: gsutil -m rsync -a $OBJECT_ACL -r ./specs gs://$GCS_BUCKET/specs/$RELEASE_ARTIFACT_ID/$RELEASE_VERSION
- name: Upload web client
run: |
gsutil -m rsync -a $OBJECT_ACL out gs://$GCS_BUCKET/client/$RELEASE_ARTIFACT_ID/$RELEASE_VERSION
gsutil cp -a $OBJECT_ACL visualizer.html gs://$GCS_BUCKET/client/$RELEASE_ARTIFACT_ID/$RELEASE_VERSION
working-directory: ./client/visualizer