Skip to content

Commit 6abb355

Browse files
add second workflow job for python release
1 parent dedb2bc commit 6abb355

File tree

1 file changed

+81
-2
lines changed

1 file changed

+81
-2
lines changed

.github/workflows/release-engine.yml

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ env:
1717
IS_PUBLIC: NO
1818

1919
jobs:
20-
release:
21-
name: Release
20+
release-java:
21+
name: Release Java
2222
runs-on: ubuntu-latest
2323
permissions:
2424
contents: read
@@ -92,3 +92,82 @@ jobs:
9292
9393
- name: Upload specs
9494
run: gsutil -m rsync -a $OBJECT_ACL -r ./specs gs://$GCS_BUCKET/specs/${RELEASE_ARTIFACT_ID}/$RELEASE_VERSION
95+
release-python:
96+
name: Release Python
97+
runs-on: ubuntu-latest
98+
permissions:
99+
contents: read
100+
id-token: write
101+
102+
steps:
103+
- uses: conda-incubator/setup-miniconda@v3
104+
with:
105+
python-version: 3.12
106+
107+
- name: Checkout branch
108+
uses: actions/checkout@v3
109+
110+
- name: Inject release version
111+
run: |
112+
release_version=${GITHUB_REF#refs/*/}
113+
release_version=${release_version#engine.}
114+
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
115+
echo "The release version is $release_version"
116+
117+
- name: Authenticate to Google Cloud Platform
118+
uses: google-github-actions/auth@v1
119+
with:
120+
create_credentials_file: true
121+
workload_identity_provider: projects/830784087321/locations/global/workloadIdentityPools/releases/providers/github-workflow
122+
service_account: [email protected]
123+
124+
- name: Set up Google Cloud SDK
125+
uses: 'google-github-actions/setup-gcloud@v1'
126+
127+
- name: Clone private maps
128+
if: ${{ env.IS_PUBLIC != 'YES' }}
129+
uses: actions/checkout@v3
130+
with:
131+
repository: battlecode/private-maps
132+
token: ${{ secrets.CI_REPOSITORY_CLONE_PAT }}
133+
path: private-maps
134+
135+
- name: Inject private maps
136+
if: ${{ env.IS_PUBLIC != 'YES' }}
137+
run: |
138+
source="private-maps/$RELEASE_ARTIFACT_ID"
139+
dest="$RELEASE_ARTIFACT_ID/maps"
140+
if [ -d "$source" ]; then
141+
cp -r -i "$source/." "$dest/" < /dev/null &> private-maps-copy-log
142+
if [ -s "private-maps-copy-log" ]; then
143+
echo "FAILED! Public and private maps should not intersect."
144+
cat private-maps-copy-log
145+
exit 1
146+
fi
147+
fi
148+
149+
- name: Build python package
150+
shell: bash -el {0} # Make sure conda is activated
151+
run: |
152+
conda info
153+
python --version
154+
pip install --upgrade build
155+
SETUPTOOLS_SCM_PRETEND_VERSION=${RELEASE_VERSION} python -m build
156+
157+
- name: Determine access control
158+
run: |
159+
[[ "$IS_PUBLIC" = "YES" ]] && acl="public-read" || acl="project-private"
160+
echo "OBJECT_ACL=$acl" >> $GITHUB_ENV
161+
echo "Objects will be uploaded with ACL $acl"
162+
163+
- name: Upload python package to remote repository
164+
run: |
165+
mv *.tar.gz battlecode.tar.gz
166+
gsutil -m cp -a $OBJECT_ACL battlecode.tar.gz gs://$GCS_BUCKET/maven/org/battlecode/${RELEASE_ARTIFACT_ID}-python/${RELEASE_VERSION}/
167+
working-directory: ./dist
168+
169+
# TODO: docs?
170+
#- name: Upload javadocs
171+
# run: |
172+
# unzip -d ${{ runner.temp }}/javadoc $HOME/.m2/repository/org/battlecode/$RELEASE_ARTIFACT_ID/$RELEASE_VERSION/*-javadoc.jar
173+
# gsutil -m rsync -a $OBJECT_ACL -r ${{ runner.temp }}/javadoc gs://$GCS_BUCKET/javadoc/$RELEASE_ARTIFACT_ID/$RELEASE_VERSION

0 commit comments

Comments
 (0)