mirror of
https://forgejo.merr.is/annika/actions-docker-extract.git
synced 2025-12-11 11:18:42 -05:00
docs: Correct (and test) documented examples (#27)
This commit is contained in:
parent
e8af259fb1
commit
15c8bf3149
3 changed files with 77 additions and 11 deletions
3
.github/tests/Dockerfile
vendored
3
.github/tests/Dockerfile
vendored
|
|
@ -9,3 +9,6 @@ RUN echo "Hello, World 3! \$(date)" > /files/003.txt
|
||||||
RUN echo "Hello, World 4! \$(date)" > /files/x/004.txt
|
RUN echo "Hello, World 4! \$(date)" > /files/x/004.txt
|
||||||
RUN echo "Hello, World 5! \$(date)" > /files/x/005.txt
|
RUN echo "Hello, World 5! \$(date)" > /files/x/005.txt
|
||||||
RUN echo "Hello, World 6! \$(date)" > /files/y/006.txt
|
RUN echo "Hello, World 6! \$(date)" > /files/y/006.txt
|
||||||
|
|
||||||
|
RUN mkdir -p /app/
|
||||||
|
RUN echo "<h1>Hello, World!</h1>" > /app/index.html
|
||||||
|
|
|
||||||
63
.github/workflows/test-readme.yaml
vendored
Normal file
63
.github/workflows/test-readme.yaml
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
name: Test Readme Example
|
||||||
|
|
||||||
|
on: [workflow_dispatch]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-extract:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Build Docker Image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./.github/tests
|
||||||
|
tags: my-example-image:latest
|
||||||
|
load: true
|
||||||
|
- uses: shrink/actions-docker-extract@v3
|
||||||
|
id: extract
|
||||||
|
with:
|
||||||
|
image: my-example-image:latest
|
||||||
|
path: /app/.
|
||||||
|
destination: dist
|
||||||
|
- name: Upload Dist
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
path: dist
|
||||||
|
example-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: "ghcr.io"
|
||||||
|
username: "${{ github.actor }}"
|
||||||
|
password: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
- name: Build Docker Image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./.github/tests
|
||||||
|
push: true
|
||||||
|
tags: ghcr.io/${{ github.repository }}:latest
|
||||||
|
login-pull-extract:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- example-image
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: "ghcr.io"
|
||||||
|
username: "${{ github.actor }}"
|
||||||
|
password: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
- uses: shrink/actions-docker-extract@v3
|
||||||
|
id: extract
|
||||||
|
with:
|
||||||
|
image: ghcr.io/${{ github.repository }}:latest
|
||||||
|
path: /app/.
|
||||||
|
destination: dist
|
||||||
|
- name: Upload Dist
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
path: dist
|
||||||
22
README.md
22
README.md
|
|
@ -44,18 +44,18 @@ jobs:
|
||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
repository: my-example-image
|
tags: my-example-image:latest
|
||||||
tags: latest
|
load: true
|
||||||
- uses: shrink/actions-docker-extract@v3
|
- uses: shrink/actions-docker-extract@v3
|
||||||
id: extract
|
id: extract
|
||||||
with:
|
with:
|
||||||
image: my-example-image
|
image: my-example-image:latest
|
||||||
path: /app/.
|
path: /app/.
|
||||||
|
destination: dist
|
||||||
- name: Upload Dist
|
- name: Upload Dist
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.extract.outputs.destination }}
|
path: dist
|
||||||
name: dist
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Login, Pull, Extract
|
### Login, Pull, Extract
|
||||||
|
|
@ -70,21 +70,21 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: "ghcr.io"
|
||||||
username: ${{ github.repository_owner }}
|
username: "${{ github.actor }}"
|
||||||
password: ${{ secrets.GHCR_PAT }}
|
password: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
- uses: shrink/actions-docker-extract@v3
|
- uses: shrink/actions-docker-extract@v3
|
||||||
id: extract
|
id: extract
|
||||||
with:
|
with:
|
||||||
image: ghcr.io/${{ github.repository }}:latest
|
image: ghcr.io/${{ github.repository }}:latest
|
||||||
path: /app/.
|
path: /app/.
|
||||||
|
destination: dist
|
||||||
- name: Upload Dist
|
- name: Upload Dist
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.extract.outputs.destination }}
|
path: dist
|
||||||
name: dist
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Automatic Release Packaging
|
## Automatic Release Packaging
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue