Skip to content

Build Theia IDE Preview Image #8

Build Theia IDE Preview Image

Build Theia IDE Preview Image #8

name: Publish Theia IDE Preview Deployment
permissions:
contents: read
on:
workflow_dispatch:
inputs:
tag:
description: The image's tag
required: true
default: next
theia_version:
description: Theia Version
required: false
default: next
pull_request:
branches: [master]
types:
- opened
- synchronize
- reopened
schedule:
- cron: '0 13 * * 0'
jobs:
build:
name: Build Theia IDE Preview image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Set the Theia version
id: set-theia-version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "THEIA_VERSION=${{ github.event.inputs.theia_version }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "pull_request" ]; then
echo "THEIA_VERSION=" >> $GITHUB_ENV
else
echo "THEIA_VERSION=next" >> $GITHUB_ENV
fi
- name: Run Theia update if version is specified
if: ${{ env.THEIA_VERSION != '' }}
run: |
yarn && yarn update:theia ${THEIA_VERSION} && yarn update:theia:children ${THEIA_VERSION} && yarn
- name: Set image tag
id: set-tag
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "IMAGE_TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "pull_request" ]; then
echo "IMAGE_TAG=pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "schedule" ]; then
echo "IMAGE_TAG=weekly" >> $GITHUB_ENV
else
echo "IMAGE_TAG=other" >> $GITHUB_ENV
fi
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
project_id: kubernetes-238012
create_credentials_file: true
- name: Setup Google Cloud SDK
uses: google-github-actions/setup-gcloud@77e7a554d41e2ee56fc945c52dfd3f33d12def9a # v2.1.4
- name: Configure Docker for Artifact Registry
run: |
gcloud auth configure-docker europe-west3-docker.pkg.dev
#- name: Build Docker image
# uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
# with:
# context: .
# file: browser.Dockerfile
# push: true
# tags: |
# europe-west3-docker.pkg.dev/kubernetes-238012/theia-ide-preview/theia-ide-preview:${{ env.IMAGE_TAG }}
- name: Get GKE Credentials
uses: google-github-actions/get-gke-credentials@d0cee45012069b163a631894b98904a9e6723729 # v2.3.3
with:
cluster_name: github-theia-ide-preview
location: europe-west3-c
service_account_key: ${{ secrets.GCP_SA_KEY }}
use_auth_provider: false
use_workload_identity: false
- name: List Pods in theia-cloud namespace
run: kubectl get pods -n theia-cloud