Skip to content

Commit 0faf0ba

Browse files
authored
Merge pull request #2 from jsdotlua/feature/release-workflow
feat: Add release workflow
2 parents 69da751 + dea9781 commit 0faf0ba

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
15+
- name: Install Aftman
16+
uses: ok-nick/setup-aftman@v0
17+
18+
- name: Authenticate Wally
19+
run: |
20+
cd packages/boolean
21+
wally login --token ${{ secrets.WALLY_ACCESS_TOKEN }}
22+
cd ../..
23+
24+
- name: Get latest release
25+
id: latest-release
26+
uses: pozetroninc/github-action-get-latest-release@master
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
continue-on-error: true # This will error if no tags have been made yet, in which case publish.sh will fallback.
30+
31+
- name: Publish changed packages
32+
run: bash ./scripts/publish.sh ${{ steps.latest-release.outputs.tag_name }}
33+
34+
- name: Build project
35+
run: rojo build --output ReactLua.rbxm
36+
37+
- name: Create GitHub Release
38+
id: create_release
39+
uses: ncipollo/release-action@v1
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
with:
43+
name: Release ${{ github.ref }}
44+
tag: ${{ github.ref }}
45+
draft: true
46+
47+
- name: Upload build artifact
48+
uses: actions/upload-release-asset@v1
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
with:
52+
upload_url: ${{ steps.create_release.outputs.upload_url }}
53+
asset_path: ./ReactLua.rbxm
54+
asset_name: ReactLua.rbxm
55+
asset_content_type: application/octet-stream

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
.DS_Store
2+
13
sourcemap.json
24
globalTypes.d.lua

scripts/publish.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
LAST_RELEASE_TAG=${1:-$(git rev-list --max-parents=0 HEAD)} # Default to the initial commit hash if no tag is found
6+
7+
# Find changed packages since the last release
8+
CHANGED_PACKAGES=$(git diff --name-only "$LAST_RELEASE_TAG" HEAD -- packages | cut -d/ -f2 | uniq)
9+
10+
for PACKAGE in $CHANGED_PACKAGES; do
11+
PACKAGE_PATH="packages/$PACKAGE"
12+
13+
if [ -d "$PACKAGE_PATH" ]; then
14+
echo "Publishing package: $PACKAGE ($PACKAGE_PATH)"
15+
16+
wally publish --project-path $PACKAGE_PATH
17+
else
18+
echo "Skipping: $PACKAGE_PATH does not exist"
19+
fi
20+
done

0 commit comments

Comments
 (0)