-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (49 loc) · 1.82 KB
/
upload-tmc-langs-rust-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 tmc-langs-rust
on:
push:
tags:
- "all-[0-9]+.[0-9]+"
- "rust-[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#rust-}" >> $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 tmc-langs-rust
docker build . -t "eu.gcr.io/moocfi-public/tmc-sandbox-tmc-langs-rust:$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 tmc-langs-rust
docker push "eu.gcr.io/moocfi-public/tmc-sandbox-tmc-langs-rust:$VERSION"
docker tag "eu.gcr.io/moocfi-public/tmc-sandbox-tmc-langs-rust:$VERSION" "eu.gcr.io/moocfi-public/tmc-sandbox-tmc-langs-rust:latest"
docker push "eu.gcr.io/moocfi-public/tmc-sandbox-tmc-langs-rust:latest"
cd ..