Skip to content

Commit b2bea73

Browse files
build: Package action as dist with latest changes
1 parent a0eaa32 commit b2bea73

File tree

3 files changed

+77
-11
lines changed

3 files changed

+77
-11
lines changed

.github/tests/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ RUN echo "Hello, World 3! \$(date)" > /files/003.txt
99
RUN echo "Hello, World 4! \$(date)" > /files/x/004.txt
1010
RUN echo "Hello, World 5! \$(date)" > /files/x/005.txt
1111
RUN echo "Hello, World 6! \$(date)" > /files/y/006.txt
12+
13+
RUN mkdir -p /app/
14+
RUN echo "<h1>Hello, World!</h1>" > /app/index.html

.github/workflows/test-readme.yaml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Test Readme Example
2+
3+
on: [workflow_dispatch]
4+
5+
jobs:
6+
build-extract:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Build Docker Image
11+
uses: docker/build-push-action@v5
12+
with:
13+
context: ./.github/tests
14+
tags: my-example-image:latest
15+
load: true
16+
- uses: shrink/actions-docker-extract@v3
17+
id: extract
18+
with:
19+
image: my-example-image:latest
20+
path: /app/.
21+
destination: dist
22+
- name: Upload Dist
23+
uses: actions/upload-artifact@v3
24+
with:
25+
path: dist
26+
example-image:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Login to GitHub Container Registry
31+
uses: docker/login-action@v3
32+
with:
33+
registry: "ghcr.io"
34+
username: "${{ github.actor }}"
35+
password: "${{ secrets.GITHUB_TOKEN }}"
36+
- name: Build Docker Image
37+
uses: docker/build-push-action@v5
38+
with:
39+
context: ./.github/tests
40+
push: true
41+
tags: ghcr.io/${{ github.repository }}:latest
42+
login-pull-extract:
43+
runs-on: ubuntu-latest
44+
needs:
45+
- example-image
46+
steps:
47+
- uses: actions/checkout@v4
48+
- name: Login to GitHub Container Registry
49+
uses: docker/login-action@v2
50+
with:
51+
registry: "ghcr.io"
52+
username: "${{ github.actor }}"
53+
password: "${{ secrets.GITHUB_TOKEN }}"
54+
- uses: shrink/actions-docker-extract@v3
55+
id: extract
56+
with:
57+
image: ghcr.io/${{ github.repository }}:latest
58+
path: /app/.
59+
destination: dist
60+
- name: Upload Dist
61+
uses: actions/upload-artifact@v3
62+
with:
63+
path: dist

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ jobs:
4444
- name: Build Docker Image
4545
uses: docker/build-push-action@v5
4646
with:
47-
repository: my-example-image
48-
tags: latest
47+
tags: my-example-image:latest
48+
load: true
4949
- uses: shrink/actions-docker-extract@v3
5050
id: extract
5151
with:
52-
image: my-example-image
52+
image: my-example-image:latest
5353
path: /app/.
54+
destination: dist
5455
- name: Upload Dist
5556
uses: actions/upload-artifact@v3
5657
with:
57-
path: ${{ steps.extract.outputs.destination }}
58-
name: dist
58+
path: dist
5959
```
6060

6161
### Login, Pull, Extract
@@ -70,21 +70,21 @@ jobs:
7070
steps:
7171
- uses: actions/checkout@v4
7272
- name: Login to GitHub Container Registry
73-
uses: docker/login-action@v1
73+
uses: docker/login-action@v2
7474
with:
75-
registry: ghcr.io
76-
username: ${{ github.repository_owner }}
77-
password: ${{ secrets.GHCR_PAT }}
75+
registry: "ghcr.io"
76+
username: "${{ github.actor }}"
77+
password: "${{ secrets.GITHUB_TOKEN }}"
7878
- uses: shrink/actions-docker-extract@v3
7979
id: extract
8080
with:
8181
image: ghcr.io/${{ github.repository }}:latest
8282
path: /app/.
83+
destination: dist
8384
- name: Upload Dist
8485
uses: actions/upload-artifact@v3
8586
with:
86-
path: ${{ steps.extract.outputs.destination }}
87-
name: dist
87+
path: dist
8888
```
8989

9090
## Automatic Release Packaging

0 commit comments

Comments
 (0)