-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (129 loc) · 4.17 KB
/
Copy pathrelease.yml
File metadata and controls
154 lines (129 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Release
on:
workflow_dispatch:
inputs:
release_tag:
description: "Release tag, e.g. v0.1.0"
required: true
type: string
pull_request:
env:
ZIG_VERSION: "0.16.0"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-bundle:
name: Build package bundle
runs-on: ubuntu-latest
outputs:
bundle_filename: ${{ steps.bundle.outputs.bundle_filename }}
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Zig
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # 2.2.1
with:
version: ${{ env.ZIG_VERSION }}
use-cache: false
- name: Install Roc
uses: roc-lang/setup-roc@66d1ae2def87ec77b8670e9ac09c418df2f18c86
with:
# Installs the latest nightly from https://github.com/roc-lang/nightlies
version: nightly-new-compiler
- name: Check format and package
run: |
roc fmt --check package examples
roc check package/main.roc
roc test package/main.roc
- name: Bundle package
id: bundle
run: |
BUNDLE_OUTPUT=$(scripts/bundle.sh --output-dir dist 2>&1)
echo "$BUNDLE_OUTPUT"
BUNDLE_PATH=$(echo "$BUNDLE_OUTPUT" | grep "^Created:" | awk '{print $2}')
BUNDLE_FILENAME=$(basename "$BUNDLE_PATH")
if [ -z "$BUNDLE_FILENAME" ]; then
echo "Error: could not extract bundle filename from roc bundle output"
exit 1
fi
echo "bundle_filename=$BUNDLE_FILENAME" >> "$GITHUB_OUTPUT"
- name: Upload package bundle artifact
uses: actions/upload-artifact@v4
with:
name: package-bundle
path: dist/${{ steps.bundle.outputs.bundle_filename }}
retention-days: 30
test-bundle:
name: Test package bundle (${{ matrix.os }})
needs: build-bundle
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-15-intel
- windows-2025
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Zig
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # 2.2.1
with:
version: ${{ env.ZIG_VERSION }}
use-cache: false
- name: Install Roc
uses: roc-lang/setup-roc@66d1ae2def87ec77b8670e9ac09c418df2f18c86
with:
# Installs the latest nightly from https://github.com/roc-lang/nightlies
version: nightly-new-compiler
- name: Download package bundle artifact
uses: actions/download-artifact@v4
with:
name: package-bundle
path: dist
- name: Test examples against downloaded bundle
run: python3 ci/test_bundle_examples.py --bundle-path "dist/${{ needs.build-bundle.outputs.bundle_filename }}"
create-release:
name: Create GitHub release
needs:
- build-bundle
- test-bundle
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
permissions:
contents: write
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download package bundle artifact
uses: actions/download-artifact@v4
with:
name: package-bundle
path: dist
- name: Install Roc
uses: roc-lang/setup-roc@66d1ae2def87ec77b8670e9ac09c418df2f18c86
with:
# Installs the latest nightly from https://github.com/roc-lang/nightlies
version: nightly-new-compiler
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
BUNDLE_FILE="dist/${{ needs.build-bundle.outputs.bundle_filename }}"
ROC_VERSION=$(roc version)
gh release create "${{ github.event.inputs.release_tag }}" \
"$BUNDLE_FILE" \
--title "${{ github.event.inputs.release_tag }}" \
--generate-notes \
--notes "Path package bundle built with Roc $ROC_VERSION."