Skip to content

Commit 9f8e326

Browse files
committed
feat(github-actions): add release workflow and README for project setup
Introduced a GitHub Actions workflow to support multi-OS builds and releases, automating the creation and uploading of assets for the `conv` tool across different operating systems. Additionally, a README file has been added to guide users through the installation and usage of the tool, emphasizing its features like number conversion between various systems and handling multiple inputs efficiently. This change aims to enhance the project's usability and accessibility for potential users and contributors, providing clear instructions and automating the release process to ensure consistent builds.
1 parent 73f63fe commit 9f8e326

File tree

3 files changed

+198
-0
lines changed

3 files changed

+198
-0
lines changed

.github/workflows/release.yml

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
tag:
6+
description: 'Tag to create and use in the release'
7+
required: true
8+
default: ''
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
include:
17+
- os: ubuntu-latest
18+
goos: linux
19+
goarch: amd64
20+
ext: ''
21+
- os: windows-latest
22+
goos: windows
23+
goarch: amd64
24+
ext: '.exe'
25+
- os: macos-latest
26+
goos: darwin
27+
goarch: amd64
28+
ext: ''
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v3
33+
34+
- name: Set up Go 1.22
35+
uses: actions/setup-go@v4
36+
with:
37+
go-version: 1.22
38+
39+
- name: Build binary
40+
run: |
41+
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o conv-${{ matrix.goos }}${{ matrix.ext }}
42+
43+
- name: Upload build artifact
44+
uses: actions/upload-artifact@v3
45+
with:
46+
name: conv-${{ matrix.goos }}${{ matrix.ext }}
47+
path: ./conv-${{ matrix.goos }}${{ matrix.ext }}
48+
49+
release:
50+
needs: build
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- name: Download Linux artifact
55+
uses: actions/download-artifact@v3
56+
with:
57+
name: conv-linux
58+
path: ./conv-linux
59+
60+
- name: Download Windows artifact
61+
uses: actions/download-artifact@v3
62+
with:
63+
name: conv-windows.exe
64+
path: ./conv-windows.exe
65+
66+
- name: Download macOS artifact
67+
uses: actions/download-artifact@v3
68+
with:
69+
name: conv-darwin
70+
path: ./conv-darwin
71+
72+
- name: Create release
73+
id: create_release
74+
uses: actions/create-release@v1
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
with:
78+
tag_name: ${{ github.event.inputs.tag }}
79+
release_name: Release ${{ github.event.inputs.tag }}
80+
draft: false
81+
prerelease: false
82+
83+
- name: Upload Linux Release Asset
84+
uses: actions/upload-release-asset@v1
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
with:
88+
upload_url: ${{ steps.create_release.outputs.upload_url }}
89+
asset_path: ./conv-linux/conv-linux
90+
asset_name: conv-linux
91+
asset_content_type: application/octet-stream
92+
93+
- name: Upload Windows Release Asset
94+
uses: actions/upload-release-asset@v1
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
with:
98+
upload_url: ${{ steps.create_release.outputs.upload_url }}
99+
asset_path: ./conv-windows.exe/conv-windows.exe
100+
asset_name: conv-windows.exe
101+
asset_content_type: application/octet-stream
102+
103+
- name: Upload macOS Release Asset
104+
uses: actions/upload-release-asset@v1
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
with:
108+
upload_url: ${{ steps.create_release.outputs.upload_url }}
109+
asset_path: ./conv-darwin/conv-darwin
110+
asset_name: conv-darwin
111+
asset_content_type: application/octet-stream

README.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# conv
2+
3+
Oh great, another number converter. Like the world needed more of those, right? But hey, you asked for it, so here it is. A CLI tool to convert numbers between decimal, binary, octal, and hexadecimal. Riveting stuff.
4+
5+
## Features
6+
7+
- Converts numbers between decimal, binary, octal, and hexadecimal. Because why not.
8+
- Supports prefixes like `0x` for hex, `0b` for binary, and `0o` for octal. Aren't these prefixes just delightful?
9+
- Prints the converted numbers with optional prefixes and labels. Because we all love options.
10+
- Handles multiple numbers in one go. Efficiency at its finest.
11+
12+
## Installation
13+
14+
Sure, just clone this amazing repository and build it yourself. You know the drill.
15+
16+
```sh
17+
git clone https://github.com/sett17/conv.git
18+
cd conv
19+
go build -o conv
20+
```
21+
22+
## Usage
23+
24+
Run the `conv` command with your preferred options. Or don't. I'm not your boss.
25+
26+
```sh
27+
./conv [options] <number> [<number> ...]
28+
```
29+
30+
### Options
31+
32+
- `--dec` Print decimal. Wow, a decimal number.
33+
- `--hex` Print hexadecimal. Because 0xDE is just too cool.
34+
- `--oct` Print octal. Like anyone really uses octal.
35+
- `--bin` Print binary. 0b1010, because why not.
36+
- `--no-prefix` Do not print prefixes. Because minimalism is a thing.
37+
- `--no-label` Do not print labels. You like it raw, I get it.
38+
39+
### Examples
40+
41+
Converting a single number:
42+
43+
```sh
44+
./conv 0x05
45+
```
46+
47+
Output:
48+
49+
```
50+
dec: 5
51+
hex: 0x5
52+
oct: 0o5
53+
bin: 0b101
54+
```
55+
56+
Converting multiple numbers, without prefixes and labels. Who needs those anyway?
57+
58+
```sh
59+
./conv --no-prefix --no-label 0x05 69 0b1010
60+
```
61+
62+
Output:
63+
64+
```
65+
5
66+
5
67+
5
68+
5
69+
70+
69
71+
45
72+
105
73+
1001101
74+
75+
10
76+
2
77+
12
78+
1010
79+
```
80+
81+
## License
82+
83+
Do whatever you want with it. Seriously, I'm done.
84+
85+
---
86+
87+
Feel free to contribute or don't. It's not like I'm expecting a flood of pull requests. Enjoy, or don't. Up to you.

conv

-2.18 MB
Binary file not shown.

0 commit comments

Comments
 (0)