Skip to content

Commit f2a5d57

Browse files
authored
to main.yml
1 parent bf7ffa6 commit f2a5d57

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/main.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Build & Deploy Godbolt Image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
TAG: nano-2022
8+
9+
jobs:
10+
build-and-push:
11+
runs-on: windows-2022
12+
13+
env:
14+
entry: pwsh.exe
15+
cmd: -NoLogo -NoProfile -ExecutionPolicy Bypass
16+
17+
outputs:
18+
image_tagged: ${{ steps.vars.outputs.image_tagged }}
19+
20+
defaults:
21+
run:
22+
shell: pwsh
23+
24+
steps:
25+
- name: Checkout Repository
26+
uses: actions/checkout@v4
27+
28+
- name: Set image tag
29+
id: vars
30+
run: |
31+
$repo = $env:GITHUB_REPOSITORY.ToLower()
32+
$imageBase = "ghcr.io/$repo"
33+
$taggedImage = "${imageBase}:${env:TAG}"
34+
"image_tagged=$taggedImage" >> $env:GITHUB_OUTPUT
35+
36+
- name: Log in to GHCR
37+
run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u $env:GITHUB_ACTOR --password-stdin
38+
39+
- name: Build Image
40+
run: |
41+
docker build `
42+
--isolation process `
43+
--build-arg "TAG=$env:TAG" `
44+
-t "${{ steps.vars.outputs.image_tagged }}" .
45+
46+
- name: Push Image
47+
run: |
48+
docker push "${{ steps.vars.outputs.image_tagged }}"
49+
50+
run-nano-container:
51+
needs: build-and-push
52+
runs-on: windows-2022
53+
54+
defaults:
55+
run:
56+
shell: pwsh
57+
58+
steps:
59+
- name: Log in to GHCR
60+
run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u $env:GITHUB_ACTOR --password-stdin
61+
62+
- name: Pull Image
63+
run: docker pull "${{ needs.build-and-push.outputs.image_tagged }}"
64+
65+
- name: Run Container
66+
run: docker run --entrypoint ${{ env.entry }} --isolation process -di --name orphan "${{ needs.build-and-push.outputs.image_tagged }}" ${{ env.cmd }}
67+
68+
- name: Inspect Container
69+
run: docker inspect orphan
70+
71+
- name: Container – Inspect Godbolt Dist
72+
run: docker exec orphan ${{ env.entry }} ${{ env.cmd }} -Command node --import=tsx --no-warnings=ExperimentalWarning ./app.js --version --dist

0 commit comments

Comments
 (0)