Skip to content

Commit 4eea18b

Browse files
authored
Release process (#844)
* feat: github action releases * feat: homebrew + scoop examples * feat: clean up for merge
1 parent acddda9 commit 4eea18b

File tree

8 files changed

+187
-66
lines changed

8 files changed

+187
-66
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@ on:
66
pull_request:
77
branches: "*"
88

9+
env:
10+
FORCE_COLOR: 1
11+
EARTHLY_CI: 'true'
12+
EARTHLY_ALLOW_PRIVILEGED: 'true'
13+
914
jobs:
1015
specs:
11-
uses: ./.github/workflows/reusable-earthly.yml
12-
with:
13-
earthly-cmd: +gh-action-essential
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: earthly/actions-setup@v1
19+
with:
20+
version: v0.8.0
21+
- uses: actions/checkout@v4
22+
- name: Run build
23+
run: |
24+
earthly +gh-action-essential
1425
1526
platform-specs:
1627
needs: specs
@@ -31,28 +42,40 @@ jobs:
3142

3243
integration-specs:
3344
needs: specs
34-
uses: ./.github/workflows/reusable-earthly.yml
35-
with:
36-
earthly-cmd: +gh-action-integration
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: earthly/actions-setup@v1
48+
with:
49+
version: v0.8.0
50+
- uses: actions/checkout@v4
51+
- name: Run build
52+
run: |
53+
earthly +gh-action-integration
3754
3855
e2e-specs:
3956
needs: integration-specs
40-
uses: ./.github/workflows/reusable-earthly.yml
41-
with:
42-
earthly-cmd: +gh-action-e2e
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: earthly/actions-setup@v1
60+
with:
61+
version: v0.8.0
62+
- uses: actions/checkout@v4
63+
- name: Run build
64+
run: |
65+
earthly +gh-action-e2e
4366
4467
e2e-security-specs:
4568
needs: integration-specs
4669
if: github.event_name == 'pull_request'
47-
uses: ./.github/workflows/reusable-earthly.yml
48-
with:
49-
earthly-cmd: >-
50-
--secret BRIGHT_TOKEN
51-
--secret BRIGHT_PROJECT_ID
52-
+gh-action-e2e-security
53-
--github_ref=${{github.ref}}
54-
--github_sha=${{github.sha}}
55-
--github_run_id=${{github.run_id}}
56-
secrets:
57-
BRIGHT_TOKEN: ${{ secrets.BRIGHT_API_KEY }}
58-
BRIGHT_PROJECT_ID: ${{ secrets.BRIGHT_PROJECT_ID }}
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: earthly/actions-setup@v1
73+
with:
74+
version: v0.8.0
75+
- uses: actions/checkout@v4
76+
- name: Run build
77+
run: |
78+
earthly +gh-action-e2e-security
79+
env:
80+
EARTHLY_SECRETS: "BRIGHT_TOKEN=${{ secrets.BRIGHT_API_KEY }},BRIGHT_PROJECT_ID=${{ secrets.BRIGHT_PROJECT_ID }}"
81+
EARTHLY_BUILD_ARGS: "github_ref=${{ github.ref }},github_sha=${{ github.sha }},github_run_id=${{ github.run_id }}"

.github/workflows/release.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Lucky CLI Release
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
tags:
9+
- "v*.*.*"
10+
11+
jobs:
12+
build-linux-amd64:
13+
runs-on: ubuntu-latest
14+
env:
15+
FORCE_COLOR: 1
16+
EARTHLY_CI: 'true'
17+
steps:
18+
- uses: earthly/actions-setup@v1
19+
with:
20+
version: v0.8.0
21+
- uses: actions/checkout@v4
22+
- name: Build and package
23+
run: |
24+
mkdir -p bin
25+
earthly --artifact +release-static/lucky ./bin/lucky
26+
sha256sum bin/lucky | awk '{print $1}' > ./bin/checksums.txt
27+
tar -czvf lucky-$GITHUB_REF_NAME-linux-amd64.tar.gz -C ./bin .
28+
- uses: actions/upload-artifact@v4
29+
with:
30+
name: linux
31+
path: lucky-${{ github.ref_name }}-linux-amd64.tar.gz
32+
if-no-files-found: error
33+
34+
build-windows-amd64:
35+
runs-on: windows-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: crystal-lang/install-crystal@v1
39+
- uses: ilammy/msvc-dev-cmd@v1
40+
- name: Build and package
41+
run: |
42+
shards build lucky --without-development --no-debug --release --static
43+
(Get-FileHash ./bin/lucky.exe).Hash | Out-File ./bin/checksums.txt
44+
Compress-Archive -Path ./bin/* -DestinationPath lucky-$GITHUB_REF_NAME-windows-amd64.zip
45+
- uses: actions/upload-artifact@v4
46+
with:
47+
name: windows
48+
path: lucky-${{ github.ref_name }}-windows-amd64.zip
49+
if-no-files-found: error
50+
51+
release:
52+
needs:
53+
- build-linux-amd64
54+
- build-windows-amd64
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: actions/download-artifact@v4
59+
with:
60+
path: artifacts
61+
- name: Checksums
62+
run: |
63+
cd artifacts
64+
sha256sum linux/lucky-$GITHUB_REF_NAME-linux-amd64.tar.gz | awk '{print $1}' > linux/lucky-$GITHUB_REF_NAME-linux-amd64.tar.gz.sha256
65+
sha256sum windows/lucky-$GITHUB_REF_NAME-windows-amd64.zip | awk '{print $1}' > windows/lucky-$GITHUB_REF_NAME-windows-amd64.zip.sha256
66+
- name: Release
67+
uses: softprops/action-gh-release@v1
68+
with:
69+
draft: true
70+
fail_on_unmatched_files: true
71+
files: |
72+
artifacts/linux/lucky-${{ github.ref_name }}-linux-amd64.tar.gz
73+
artifacts/linux/lucky-${{ github.ref_name }}-linux-amd64.tar.gz.sha256
74+
artifacts/windows/lucky-${{ github.ref_name }}-windows-amd64.zip
75+
artifacts/windows/lucky-${{ github.ref_name }}-windows-amd64.zip.sha256

.github/workflows/reusable-earthly.yml

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

.github/workflows/weekly.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77

88
jobs:
99
integration-specs:
10-
uses: ./.github/workflows/reusable-earthly.yml
11-
with:
12-
earthly-cmd: +gh-action-weekly
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: earthly/actions-setup@v1
13+
with:
14+
version: v0.8.0
15+
- uses: actions/checkout@v4
16+
- name: Run build
17+
run: |
18+
earthly +gh-action-weekly

Earthfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ weekly-nightly-full-web-app:
137137
RUN docker run --network=host lucky-image:latest
138138
END
139139

140+
# release-static builds an executable statically linked
141+
release-static:
142+
FROM 84codes/crystal:latest-alpine
143+
WORKDIR /workdir
144+
COPY --dir src ./
145+
COPY shard.yml ./
146+
RUN apk add yaml-static
147+
RUN shards build lucky --without-development --no-debug --release --static
148+
SAVE ARTIFACT ./bin/lucky
149+
140150
build-lucky:
141151
WORKDIR /lucky_cli
142152
COPY --dir src ./

Formula/lucky.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# `brew install luckyframework/lucky_cli/lucky`
2+
class Lucky < Formula
3+
desc "A Crystal command-line tool for generating new Lucky Web Applications"
4+
homepage "https://github.com/luckyframework/lucky_cli"
5+
license "MIT"
6+
url "https://github.com/luckyframework/lucky_cli/archive/refs/tags/v1.2.0.zip"
7+
sha256 "6fad3305c5d842a2a4efe59d8f9e51ec1ebf38e4ac7633dbcc88c8b855cd5be2"
8+
version "1.2.0"
9+
10+
depends_on "crystal" => :build
11+
depends_on "git" => :build
12+
13+
def install
14+
system "shards", "build", "lucky", "--without-development", "--no-debug", "--release"
15+
bin.install "./bin/lucky"
16+
end
17+
18+
def test
19+
assert_match "1.2.0", shell_output("#{bin}/lucky --version").split(" ")[2]
20+
end
21+
end
22+
23+
# `scoop bucket add lucky https://github.com/luckyframework/lucky_cli`
24+
# `scoop install lucky`

bucket/lucky.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"version": "1.2.0",
3+
"description": "A Crystal command-line tool for generating new Lucky Web Applications",
4+
"homepage": "https://github.com/luckyframework/lucky_cli",
5+
"license": "MIT",
6+
"architecture": {
7+
"64bit": {
8+
"url": "https://github.com/luckyframework/lucky_cli/releases/download/v1.2.0/lucky-1.2.0-windows-amd64.zip",
9+
"hash": "70edef1b1a7e3f6b534c70d624f65a01a369ea8db3e9266f7997e06c2a8d4505"
10+
}
11+
},
12+
"bin": "lucky.exe",
13+
"checkver": "github",
14+
"autoupdate": {
15+
"architecture": {
16+
"64bit": {
17+
"url": "https://github.com/luckyframework/lucky_cli/releases/download/v$version/lucky-$version-windows-amd64.zip"
18+
}
19+
},
20+
"hash": {
21+
"url": "$url.sha256"
22+
}
23+
}
24+
}

shard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ dependencies:
2424
version: ~> 0.3.0
2525
nox:
2626
github: crystal-loot/nox
27-
version: ~> 0.2.2
27+
version: ~> 0.2.3

0 commit comments

Comments
 (0)