Introduction
Github Actions, is a continuous integration tool from GitHub, offers developers a new way to automate workflows.
Each action, which is a set of custom instructions can be combined with other actions to create a workflow.
Github Actions container specifications 🏷
When I ran some tests on Github actions, I found out that these temporary containers are very powerful machines. Below are some specs (for Ubuntu 18.04):
- CPU: Intel Xeon E5-2673 v4 (2) @ 2.294GHz
- Memory: Around 500MB (test showed usage 470MiB / 6954MiB )
- GPU: Microsoft Corporation Hyper-V virtual VGA
- Free Space (approx.): 20G
- SpeedTest:
- Download: 1180.01 Mbit/s
- Upload: 699.50 Mbit/s
That was pretty amazing ✨. Moreover it was capable of installing multiple packages and running multiple languages.
Let’s get Started 🚀
The scope of this article is to get a Temporary File Sharing Platform
for short amount of time
What do we need to make this work ?
Step 1:
Create a Github Repository, can be public (as we don’t share/show Ngrok URL details with anyone)
Step 2:
Create a file named fileshare.yml
under .github/workflows
, so that file path will be .github/workflows/fileshare.yml
Step 3:
Below is the workflow
we need to use … It’s pretty basic, you may add more params to browsepy
or use pyngrok
for more functionality :)
Paste the code below in fileshare.yml
|
|
We will be using BrowsePy - a simple web file browser using Flask. This has feature that we need:
- Simple, like Python’s SimpleHTTPServer or Apache’s Directory Listing.
- Downloadable directories, streaming directory tarballs on the fly.
- Optional remove for files under given path.
- Optional upload for directories under given path.
Ngrok offers, in Free tier:
- HTTP/TCP tunnels on random URLs/ports
- 1 online ngrok process
- 4 tunnels per ngrok process
- 40 connections per minute
which is fair for this project.
I have added timeout 20m
so that ‘browsepy’ will quit after 20 minutes, although github actions can run for ~50 minutes !
At last we remove uploaded files and auth-token from runner by
rm -rf public/
rm -rf ~/.ngrok2/
Step 4:
Now we have to do 2 more steps for Ngrok to work:
- Get the
Ngrok Authtoken
from https://dashboard.ngrok.com/auth/your-authtoken which will be different for each account - Put the
Ngrok Authtoken
inhttps://github.com/<your repo>/settings/secrets
as
Step 5:
We can now go to Actions Tab for Repository
created
And RUN
the workflow
After Running go to ngrok dashboard to find the Tunnel Url
Tunnels Online : https://dashboard.ngrok.com/status/tunnels
Finally 🎉
Go to the https://<tunnel url>.ngrok.io/
and enjoy Temporary File Sharing
Kudos to you if you have read so far 🙌