Skip to content

Commit f96bf4f

Browse files
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
1 parent 98e7904 commit f96bf4f

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Re-push image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
image:
7+
description: 'Image ID'
8+
required: true
9+
10+
jobs:
11+
build-and-push:
12+
name: Build and push images
13+
if: ${{ startsWith(github.ref, 'refs/heads/') }}
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Free more space
17+
id: free_space
18+
run: |
19+
set -e
20+
# Ensure enough space is available for build
21+
sudo apt-get autoremove -y
22+
sudo apt-get clean -y
23+
sudo rm -rf /usr/share/dotnet
24+
25+
- name: Checkout ref
26+
id: checkout_ref
27+
uses: actions/checkout@v3
28+
with:
29+
path: 'ref'
30+
ref: ${{ github.ref }}
31+
32+
- name: Checkout release
33+
id: checkout_release
34+
uses: actions/checkout@v3
35+
with:
36+
path: 'release'
37+
ref: ${{ github.event.inputs.release }}
38+
39+
- name: Azure CLI login
40+
id: az_login
41+
uses: azure/login@v1
42+
with:
43+
creds: ${{ secrets.AZ_ACR_CREDS }}
44+
45+
- name: Build and push
46+
id: build_and_push
47+
env:
48+
REGISTRY: ${{ secrets.REGISTRY }}
49+
REGISTRY_BASE_PATH: ${{ secrets.REGISTRY_BASE_PATH }}
50+
STUB_REGISTRY: ${{ secrets.STUB_REGISTRY }}
51+
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
52+
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
53+
run: |
54+
set -e
55+
56+
# ACR login
57+
ACR_REGISTRY_NAME=$(echo "$REGISTRY" | grep -oP '(.+)(?=\.azurecr\.io)')
58+
az acr login --name $ACR_REGISTRY_NAME
59+
60+
# Setup build CLI
61+
cd "$GITHUB_WORKSPACE/ref"
62+
yarn install
63+
npm install -g @devcontainers/cli
64+
65+
# Go to the release, symlink the build tool from ref since this is the version for the workflow
66+
cd "$GITHUB_WORKSPACE/release"
67+
rm -rf build node_modules
68+
ln -s "$GITHUB_WORKSPACE/ref/build" build
69+
ln -s "$GITHUB_WORKSPACE/ref/node_modules" node_modules
70+
71+
build/vscdc push --replace-images \
72+
--release main \
73+
--registry "$REGISTRY" \
74+
--registry-path "$REGISTRY_BASE_PATH" \
75+
--stub-registry "$STUB_REGISTRY" \
76+
--stub-registry-path "$STUB_REGISTRY_BASE_PATH" \
77+
--secondary-registry-path "$SECONDARY_REGISTRY_BASE_PATH" \
78+
${{ github.event.inputs.image }}

0 commit comments

Comments
 (0)