aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/job.yml
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2022-02-09 19:16:32 +0200
committerJan Tuomi <jans.tuomi@gmail.com>2022-02-09 20:43:20 +0200
commitc1b9860963b5d98b89c890d9e3e552207b4e1371 (patch)
tree53b55c34685a656b97bd89402fb0ffc1df62645f /.github/workflows/job.yml
parent7c943f96adf24d2a2969a81d8df41f43f2882c14 (diff)
Add CI
Diffstat (limited to '.github/workflows/job.yml')
-rw-r--r--.github/workflows/job.yml44
1 files changed, 44 insertions, 0 deletions
diff --git a/.github/workflows/job.yml b/.github/workflows/job.yml
new file mode 100644
index 0000000..cffca84
--- /dev/null
+++ b/.github/workflows/job.yml
@@ -0,0 +1,44 @@
+name: Build and publish Runner API
+on:
+ push:
+ branches:
+ - main
+env:
+ IMAGE: eu.gcr.io/slam-lang/slam-runner-api
+jobs:
+ build-and-publish:
+ runs-on: ubuntu-latest
+ steps:
+ - id: checkout
+ uses: actions/checkout@v2
+
+ - name: "Compute new image tag"
+ run: |
+ echo "Long commit SHA: ${GITHUB_SHA}"
+ export TAG=$(echo "${GITHUB_SHA}" | head -c 7)
+ echo "TAG: ${TAG}"
+ echo "TAG=${TAG}" >> ${GITHUB_ENV}
+
+ - id: "auth"
+ uses: "google-github-actions/auth@v0"
+ with:
+ credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
+
+ - name: "Set up Cloud SDK"
+ uses: "google-github-actions/setup-gcloud@v0"
+
+ - name: Build and tag
+ run: |
+ gcloud auth configure-docker --quiet
+ if docker pull "${IMAGE}:latest"; then
+ docker build -t "${IMAGE}:${TAG}" --cache-from="${IMAGE}:latest" .
+ else
+ docker build -t "${IMAGE}:${TAG}" .
+ fi
+ docker tag "${IMAGE}:${TAG}" "${IMAGE}:latest"
+
+ - name: Publish
+ run: |
+ docker push "${IMAGE}:${TAG}"
+ docker push "${IMAGE}:latest"
+ echo "Published ${IMAGE}:${TAG}"