Skip to content

Commit f084a07

Browse files
committed
build: use just to upload with data
1 parent 8a1f853 commit f084a07

File tree

5 files changed

+71
-48
lines changed

5 files changed

+71
-48
lines changed

.github/workflows/main.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
branches:
1111
- master
1212
- dev
13+
- wip
14+
tags:
15+
- "v*"
1316

1417
concurrency:
1518
group: ${{ github.sha }}
@@ -23,24 +26,36 @@ jobs:
2326
include:
2427
- os: ubuntu-latest
2528
- os: macos-latest
26-
- os: windows-latest
29+
# - os: windows-latest
2730
runs-on: ${{ matrix.os }}
2831
steps:
2932
- name: Download source
3033
uses: actions/checkout@v4
34+
- uses: extractions/setup-crate@v1
35+
with:
36+
repo: casey/just
37+
- uses: actions/setup-go@v5
38+
if: matrix.os != 'ubuntu-latest'
39+
with:
40+
go-version: stable
3141
- name: Install Crystal
3242
uses: crystal-lang/install-crystal@v1
3343
- name: Install shards
3444
run: shards install
3545
- name: Build
36-
run: rake upload
46+
run: just upload
3747
- name: Upload Artifact
3848
uses: actions/upload-artifact@v5
3949
with:
40-
name: choose-dev-${{ matrix.os }}
41-
path: "upload/*"
50+
name: choose-${{ matrix.os }}.zip
51+
path: |
52+
- upload/*.zip
53+
- upload/*.sha256sum
4254
- name: Upload to Release
4355
if: startsWith(github.ref, 'refs/tags/v')
4456
uses: softprops/action-gh-release@v2
4557
with:
46-
files: "upload/*"
58+
token: ${{ secrets.GHP }}
59+
files: |
60+
- upload/*.zip
61+
- upload/*.sha256sum

Justfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
NAME := "choose"
2+
VERSION := "v0.1.0"
3+
4+
WORKDIR := justfile_directory()
5+
GOOS := shell("go env GOOS")
6+
GOARCH := shell("go env GOARCH")
7+
GOARM := shell("go env GOARM")
8+
DATA := "_license"
9+
10+
default:
11+
just --list --unsorted --justfile {{justfile()}}
12+
13+
build:
14+
shards build
15+
16+
release:
17+
shards build --release
18+
19+
[no-cd]
20+
run ARGS="": build
21+
{{WORKDIR}}/bin/{{NAME}} {{ ARGS }}
22+
23+
target: release
24+
mkdir -p target/{{GOOS}}/{{GOARCH}}/{{GOARM}}
25+
ln -f bin/{{NAME}} target/{{GOOS}}/{{GOARCH}}/{{GOARM}}/
26+
cp -a src/{{NAME}}/{{DATA}} target/{{GOOS}}/{{GOARCH}}/{{GOARM}}/
27+
# tree target
28+
29+
cd target/{{GOOS}}/{{GOARCH}}/{{GOARM}}/ && ./{{NAME}} list
30+
31+
upload: release
32+
mkdir -p upload/{{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}
33+
ln -f bin/{{NAME}} upload/{{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}/
34+
cp -a src/{{NAME}}/{{DATA}} upload/{{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}/
35+
# tree upload
36+
37+
cd upload/{{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}/ && ./{{NAME}} list
38+
cd upload && zip -r {{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}.zip {{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}
39+
cd upload && sha256sum {{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}.zip > {{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}.sha256sum
40+
41+
upload-single: release
42+
mkdir -p upload
43+
ln -f bin/{{NAME}} upload/{{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}
44+
# tree upload
45+
46+
cd upload && sha256sum {{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}} > {{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}.sha256sum
47+
48+
clean:
49+
rm -rf target upload

Rakefile

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/choose.cr

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Choose
99
@@fullname : String?
1010

1111
def self.banner
12-
str = <<-EOF
12+
<<-EOF
1313
choose - A wise license generator
1414
1515
Usage:
@@ -28,8 +28,6 @@ module Choose
2828
2929
Options:
3030
EOF
31-
32-
str
3331
end
3432

3533
def self.run(argv)

src/choose/license.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Choose::License
2525

2626
class MoreThanOne < Exception; end
2727

28-
LICENSE_DIR = "#{__DIR__}/_license"
28+
LICENSE_DIR = "_license"
2929

3030
@@width = 80
3131

0 commit comments

Comments
 (0)