-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New workflow - Allows manually pushing dev images from branch (#759)
* New workflow - Allows manually pushing dev images from branch * Update push-manual-dev.yml * address comments
- Loading branch information
1 parent
98e7904
commit f96bf4f
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Re-push image | ||
|
||
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: Azure CLI login | ||
id: az_login | ||
uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZ_ACR_CREDS }} | ||
|
||
- name: Build and push | ||
id: build_and_push | ||
env: | ||
REGISTRY: ${{ secrets.REGISTRY }} | ||
REGISTRY_BASE_PATH: ${{ secrets.REGISTRY_BASE_PATH }} | ||
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }} | ||
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }} | ||
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }} | ||
run: | | ||
set -e | ||
# ACR login | ||
ACR_REGISTRY_NAME=$(echo "$REGISTRY" | grep -oP '(.+)(?=\.azurecr\.io)') | ||
az acr login --name $ACR_REGISTRY_NAME | ||
# 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" \ | ||
--secondary-registry-path "$SECONDARY_REGISTRY_BASE_PATH" \ | ||
${{ github.event.inputs.image }} |