github actions template

- add Dockerfile
- add entrypoint
- add Github workflow
This commit is contained in:
Jayantajit Gogoi 2022-08-05 17:58:22 +00:00
parent 33dd650635
commit 9fcb6f8577
7 changed files with 55 additions and 0 deletions

23
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,23 @@
on: [push]
jobs:
pages-directory-listing:
runs-on: ubuntu-latest
name: Test Actions Template
steps:
# To use this repository's private action,
# you must check out the repository
- name: Checkout
uses: actions/checkout@v3
- name: Generate Directory Listings
uses: ./ # Uses an action in the root directory
with:
FOLDER: tests
- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: tests

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
# Container image that runs your code
ARG VARIANT="3.10-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh
# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]

12
action.yml Normal file
View File

@ -0,0 +1,12 @@
# action.yml
name: 'Github Pages Directory Listing'
description: 'Generate Directory Listing index for Github Pages'
inputs:
FOLDER:
description: 'folder to start index generations'
required: true
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.FOLDER }}

11
entrypoint.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh -l
sudo apt-get update
sudo apt-get install cmake python3 -y
git clone --depth 1 https://github.com/jayanta525/apindex-v2.git
cd apindex-v2
cmake . -DCMAKE_INSTALL_PREFIX=/usr
sudo make install
cd ..
rm -rf apindex-v2/
apindex $1/.

0
tests/abc.txt Normal file
View File

0
tests/abc/abcdef.txt Normal file
View File

0
tests/def.txt Normal file
View File