mirror of
https://forgejo.merr.is/annika/actions-docker-extract.git
synced 2025-12-11 14:39:57 -05:00
🐛 Extract contents of directory (#4)
This commit is contained in:
parent
0f83fca17f
commit
7d86f1b9ad
6 changed files with 103 additions and 59 deletions
11
.github/tests/Dockerfile
vendored
Normal file
11
.github/tests/Dockerfile
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
FROM alpine
|
||||
|
||||
RUN mkdir -p /files/x
|
||||
RUN mkdir -p /files/y
|
||||
|
||||
RUN echo "Hello, World 1! \$(date)" > /files/001.txt
|
||||
RUN echo "Hello, World 2! \$(date)" > /files/002.txt
|
||||
RUN echo "Hello, World 3! \$(date)" > /files/003.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 6! \$(date)" > /files/y/006.txt
|
||||
48
.github/workflows/directory.yml
vendored
Normal file
48
.github/workflows/directory.yml
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
name: Test Directory Extraction
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
root-directory:
|
||||
runs-on: ubuntu-latest
|
||||
name: Extract Contents of Directory from Example Image
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: docker build -t example:${{ github.sha }} ./.github/tests
|
||||
- uses: ./
|
||||
id: extract
|
||||
with:
|
||||
image: example:${{ github.sha }}
|
||||
path: /files/.
|
||||
- run: test -e ${{ steps.extract.outputs.destination }}/001.txt || exit 1
|
||||
- run: test -e ${{ steps.extract.outputs.destination }}/002.txt || exit 1
|
||||
- run: test -e ${{ steps.extract.outputs.destination }}/003.txt || exit 1
|
||||
- run: test -e ${{ steps.extract.outputs.destination }}/x/004.txt || exit 1
|
||||
- run: test -e ${{ steps.extract.outputs.destination }}/x/005.txt || exit 1
|
||||
- run: test -e ${{ steps.extract.outputs.destination }}/y/006.txt || exit 1
|
||||
nested-directory:
|
||||
runs-on: ubuntu-latest
|
||||
name: Extract Nested Directory from Example Image
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: docker build -t example:${{ github.sha }} ./.github/tests
|
||||
- uses: ./
|
||||
id: extract
|
||||
with:
|
||||
image: example:${{ github.sha }}
|
||||
path: /files/x
|
||||
- run: test -e ${{ steps.extract.outputs.destination }}/x/004.txt || exit 1
|
||||
- run: test -e ${{ steps.extract.outputs.destination }}/x/005.txt || exit 1
|
||||
nested-directory-contents:
|
||||
runs-on: ubuntu-latest
|
||||
name: Extract Nested Contents of Directory from Example Image
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: docker build -t example:${{ github.sha }} ./.github/tests
|
||||
- uses: ./
|
||||
id: extract
|
||||
with:
|
||||
image: example:${{ github.sha }}
|
||||
path: /files/x/.
|
||||
- run: test -e ${{ steps.extract.outputs.destination }}/004.txt || exit 1
|
||||
- run: test -e ${{ steps.extract.outputs.destination }}/005.txt || exit 1
|
||||
29
.github/workflows/file.yml
vendored
Normal file
29
.github/workflows/file.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
name: Test File Extraction
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
root-file:
|
||||
runs-on: ubuntu-latest
|
||||
name: Extract Example File From Root of Built Image
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: docker build -t example:${{ github.sha }} ./.github/tests
|
||||
- uses: ./
|
||||
id: extract
|
||||
with:
|
||||
image: example:${{ github.sha }}
|
||||
path: /files/001.txt
|
||||
- run: test -e ${{ steps.extract.outputs.destination }}/001.txt || exit 1
|
||||
nested-file:
|
||||
runs-on: ubuntu-latest
|
||||
name: Extract Nexted Example File From Built Image
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: docker build -t example:${{ github.sha }} ./.github/tests
|
||||
- uses: ./
|
||||
id: extract
|
||||
with:
|
||||
image: example:${{ github.sha }}
|
||||
path: /files/y/006.txt
|
||||
- run: test -e ${{ steps.extract.outputs.destination }}/006.txt || exit 1
|
||||
50
.github/workflows/test.yml
vendored
50
.github/workflows/test.yml
vendored
|
|
@ -1,50 +0,0 @@
|
|||
name: Test Extraction Action
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
extract-motd:
|
||||
runs-on: ubuntu-latest
|
||||
name: Extract MOTD From Alpine
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Extract
|
||||
id: extract
|
||||
uses: ./
|
||||
with:
|
||||
image: 'alpine'
|
||||
path: '/etc/motd'
|
||||
- name: Upload Extracted MOTD
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: ${{ steps.extract.outputs.destination }}/motd
|
||||
name: alpine-motd
|
||||
example:
|
||||
runs-on: ubuntu-latest
|
||||
name: Extract Example From Built Image
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Create Example Dockerfile
|
||||
run: |
|
||||
cat <<-DOCKERFILE > Dockerfile
|
||||
FROM alpine
|
||||
RUN mkdir -p /app
|
||||
RUN echo "Hello, World! \$(date)" > /app/example
|
||||
DOCKERFILE
|
||||
- name: Build Docker Image
|
||||
uses: docker/build-push-action@v1
|
||||
with:
|
||||
repository: example
|
||||
tags: ${{ github.sha }}
|
||||
push: false
|
||||
- uses: ./
|
||||
id: extract
|
||||
with:
|
||||
image: example:${{ github.sha }}
|
||||
path: /app
|
||||
- name: Upload Dist
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: ${{ steps.extract.outputs.destination }}
|
||||
name: dist
|
||||
Loading…
Add table
Add a link
Reference in a new issue