Skip to content

Commit 449017c

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

File tree

5 files changed

+71
-49
lines changed

5 files changed

+71
-49
lines changed

.github/workflows/main.yml

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

1417
concurrency:
15-
group: ${{ github.sha }}
18+
group: ${{ github.workflow }}-${{ github.ref }}
1619
cancel-in-progress: true
1720

1821
jobs:
@@ -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: "!startsWith(matrix.os, 'ubuntu')"
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-${{ github.ref_name }}-${{ 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: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
run ARGS="": build
20+
cd src/{{NAME}} && {{WORKDIR}}/bin/{{NAME}} {{ ARGS }}
21+
22+
target: release
23+
mkdir -p target/{{GOOS}}/{{GOARCH}}/{{GOARM}}
24+
ln -f bin/{{NAME}} target/{{GOOS}}/{{GOARCH}}/{{GOARM}}/
25+
cp -a src/{{NAME}}/{{DATA}} target/{{GOOS}}/{{GOARCH}}/{{GOARM}}/
26+
# tree target
27+
28+
cd target/{{GOOS}}/{{GOARCH}}/{{GOARM}}/ && ./{{NAME}} list
29+
30+
upload: release
31+
mkdir -p upload/{{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}
32+
ln -f bin/{{NAME}} upload/{{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}/
33+
cp -a src/{{NAME}}/{{DATA}} upload/{{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}/
34+
# tree upload
35+
36+
cd upload/{{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}/ && ./{{NAME}} list
37+
cd upload && zip -r {{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}.zip {{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}
38+
cd upload && sha256sum {{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}.zip > {{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}.sha256sum
39+
40+
upload-single: release
41+
mkdir -p upload
42+
ln -f bin/{{NAME}} upload/{{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}
43+
# tree upload
44+
45+
cd upload && sha256sum {{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}} > {{NAME}}-{{VERSION}}-{{GOOS}}-{{GOARCH}}{{GOARM}}.sha256sum
46+
47+
clean:
48+
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)