Skip to content

Commit 7ee0432

Browse files
committed
Add windows workflow
1 parent 6ef1ade commit 7ee0432

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/windows-msvc.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
push:
3+
tags:
4+
- "v*.*.*"
5+
6+
jobs:
7+
build:
8+
runs-on: windows-2022
9+
steps:
10+
- name: Cache shards
11+
uses: actions/cache@v2
12+
with:
13+
path: ~/.cache/shards
14+
key: ${{ runner.os }}-shards-${{ hashFiles('shard.yml') }}
15+
restore-keys: ${{ runner.os }}-shards-
16+
17+
- name: Download source
18+
uses: actions/checkout@v4
19+
20+
- name: Install Crystal
21+
uses: crystal-lang/install-crystal@v1
22+
23+
- name: Install shards
24+
run: shards check || shards install --without-development
25+
26+
- name: Collect package information
27+
run: |
28+
echo "BINARY_NAME=bin/$(cat shard.yml |Select-String -Pattern 'targets:' -Context 1 |%{$_ -replace '> targets:',''}|%{$_ -replace '[\s:]*',''})" >> $Env:GITHUB_ENV
29+
echo "PKG_ARCH=x86_64" >> $Env:GITHUB_ENV
30+
echo "PLATFORM=pc-windows-msvc.zip" >> $Env:GITHUB_ENV
31+
echo "BUILD_ARGS=" >> $Env:GITHUB_ENV
32+
33+
- name: Set asset name
34+
run: |
35+
echo "ASSERT_NAME=${{env.BINARY_NAME}}-${{github.ref_name}}-${{env.PKG_ARCH}}-${{env.PLATFORM}}" >> $Env:GITHUB_ENV
36+
37+
- name: Build release binary
38+
id: release
39+
run: |
40+
echo "ASSERT_NAME=${{env.ASSERT_NAME}}" >> $Env:GITHUB_OUTPUT
41+
shards build --production --progress --no-debug -Dstrict_multi_assign -Dno_number_autocast ${{env.BUILD_ARGS}}
42+
7z a ${{env.ASSERT_NAME}} ${{env.BINARY_NAME}}.exe LICENSE
43+
44+
- name: Release
45+
uses: softprops/action-gh-release@v1
46+
if: startsWith(github.ref, 'refs/tags/')
47+
with:
48+
files: |
49+
${{steps.release.outputs.ASSERT_NAME}}

0 commit comments

Comments
 (0)