Skip to content

Manually build and push dev images #2

Manually build and push dev images

Manually build and push dev images #2

name: Manually build and push dev images
on:
workflow_dispatch:
inputs:
image:
description: 'Image ID'
required: true
jobs:
build-and-push:
name: Build and push images
if: ${{ startsWith(github.ref, 'refs/heads/') }}
runs-on: ubuntu-latest
steps:
- name: Free more space
id: free_space
run: |
set -e
# Ensure enough space is available for build
sudo apt-get autoremove -y
sudo apt-get clean -y
sudo rm -rf /usr/share/dotnet
- name: Checkout ref
id: checkout_ref
uses: actions/checkout@v3
with:
path: 'ref'
ref: ${{ github.ref }}
- name: Checkout release
id: checkout_release
uses: actions/checkout@v3
with:
path: 'release'
ref: ${{ github.event.inputs.release }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: build_and_push
env:
DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }}
REGISTRY: ${{ secrets.REGISTRY }}
REGISTRY_BASE_PATH: ${{ secrets.REGISTRY_BASE_PATH }}
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }}
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
run: |
set -e
# Docker login
docker login -u $DOCKER_USER -p $DOCKER_PASS
# Setup build CLI
cd "$GITHUB_WORKSPACE/ref"
yarn install
npm install -g @devcontainers/cli
# Go to the release, symlink the build tool from ref since this is the version for the workflow
cd "$GITHUB_WORKSPACE/release"
rm -rf build node_modules
ln -s "$GITHUB_WORKSPACE/ref/build" build
ln -s "$GITHUB_WORKSPACE/ref/node_modules" node_modules
build/vscdc push --replace-images \
--release main \
--registry "$REGISTRY" \
--registry-path "$REGISTRY_BASE_PATH" \
--stub-registry "$STUB_REGISTRY" \
--stub-registry-path "$STUB_REGISTRY_BASE_PATH" \
${{ github.event.inputs.image }}