3 min read | by Jordi Prats
It is quite anoying when you keep typing mkdit instead of mkdir for creating a directory just as it is to type sl instead of ls. At least, for sl there's an actual Debian package that, the Steam Locomotive. Having this in mind I created another tool called mkdir:
https://github.com/jordiprats/bash-mkdit
Using this as an example we will configure a github action to build .deb and .rpm packages for this tool.
sl shows you an ASCII steam locomotive crossing your terminal when you mistype it. On the other hand, mkdit shows you an ASCII middle dit (finger) (but it also creates the directory so your productivity is not impacted due to your lack of skills):
$ mkdit aaa ....................../´¯/) ....................,/¯../ .................../..../ ............./´¯/'...'/´¯¯`·¸ ........../'/.../..../......./¨¯\ ........('(...´...´.... ¯~/'...') .........\.................'...../ ..........''...\.......... _.·´ ............\..............( ..............\.............\...
dit means finger in Catalan, a language spoken on the Catalan Republic, Andorra and some parts France, Spain and even Italy.
We are going to use Github Actions (we could be doing exactly the same using Jenkins) to build this bash script into a packages (deb and rpm) when a new release is created:
Here we are telling github when to trigger this job (on release creation):
on: release: types: [created]
Once triggered, the job has several steps:
First, it checkouts the repository itself:
- uses: actions/checkout@v2
Created the deb package using the package.yaml file that resides on the repository we have just checked out:
- uses: kentik/pkg@v1.0.0-rc6 with: name: mkdit version: ${{ github.event.release.tag_name }} arch: amd64 format: deb package: package.yaml
Then it uploads the deb file to the release page:
- name: Upload deb uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ./*.deb tag: ${{ github.ref }} overwrite: true body: "" file_glob: true
Then we do the same with the rpm package, first we build it:
- uses: kentik/pkg@v1.0.0-rc6 with: name: mkdit version: ${{ github.event.release.tag_name }} arch: x86_64 format: rpm package: package.yaml
Then is attached to the release:
- name: Upload RPM uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ./*.rpm tag: ${{ github.ref }} overwrite: true body: "" file_glob: true
Once it is completed we will be able to see both packages uploaded:
Posted on 22/01/2021