-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (49 loc) · 1.8 KB
/
upload-python-alp-image.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
name: Deploy Python for ALP
on:
push:
tags:
- "all-[0-9]+.[0-9]+"
- "python-alp-[0-9]+.[0-9]+"
env:
TAG: ${{ github.ref_name }}
jobs:
build_and_upload:
name: Build and deploy
runs-on: ubuntu-latest
steps:
- name: Extract version from tag
run: |
echo "VERSION=${TAG#all-}" >> $GITHUB_ENV
echo "VERSION=${TAG#python-alp-}" >> $GITHUB_ENV
- name: Enable Docker IPv6
run: |
echo '{ "ipv6": true }' | sudo tee -a /etc/docker/daemon.json
sudo systemctl reload docker
- uses: actions/checkout@v1
- name: Authenticate to Google Cloud
env:
GCLOUD_SERVICE_KEY: ${{ secrets.GCLOUD_SERVICE_KEY }}
run: |
echo Authenticating to Google Cloud
echo $GCLOUD_SERVICE_KEY | python -m base64 -d > /tmp/key.json
gcloud auth activate-service-account --key-file=/tmp/key.json
if gcloud auth configure-docker -q; then
echo "Authenticated to Google Cloud..."
else
echo "Authentication to Google Cloud failed. Exiting..."
exit 1
fi
- name: Building image
run: |
source ./env
cd python-alp
docker build . -t "eu.gcr.io/moocfi-public/tmc-sandbox-python-alp:$VERSION" --build-arg "RUST_CLI_URL=$RUST_CLI_URL" --build-arg "SANDBOX_PYTHON_VERSION=$SANDBOX_PYTHON_VERSION"
cd ..
- name: Pushing image
run: |
source ./env
cd python-alp
docker push "eu.gcr.io/moocfi-public/tmc-sandbox-python-alp:$VERSION"
docker tag "eu.gcr.io/moocfi-public/tmc-sandbox-python-alp:$VERSION" "eu.gcr.io/moocfi-public/tmc-sandbox-python-alp:latest"
docker push "eu.gcr.io/moocfi-public/tmc-sandbox-python-alp:latest"
cd ..