Skip to content

feat: Add release workflow #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Aftman
uses: ok-nick/setup-aftman@v0

- name: Authenticate Wally
run: |
cd packages/boolean
wally login --token ${{ secrets.WALLY_ACCESS_TOKEN }}
cd ../..

- name: Get latest release
id: latest-release
uses: pozetroninc/github-action-get-latest-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true # This will error if no tags have been made yet, in which case publish.sh will fallback.

- name: Publish changed packages
run: bash ./scripts/publish.sh ${{ steps.latest-release.outputs.tag_name }}

- name: Build project
run: rojo build --output ReactLua.rbxm

- name: Create GitHub Release
id: create_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release ${{ github.ref }}
tag: ${{ github.ref }}
draft: true

- name: Upload build artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ReactLua.rbxm
asset_name: ReactLua.rbxm
asset_content_type: application/octet-stream
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.DS_Store

sourcemap.json
globalTypes.d.lua
20 changes: 20 additions & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -e

LAST_RELEASE_TAG=${1:-$(git rev-list --max-parents=0 HEAD)} # Default to the initial commit hash if no tag is found

# Find changed packages since the last release
CHANGED_PACKAGES=$(git diff --name-only "$LAST_RELEASE_TAG" HEAD -- packages | cut -d/ -f2 | uniq)

for PACKAGE in $CHANGED_PACKAGES; do
PACKAGE_PATH="packages/$PACKAGE"

if [ -d "$PACKAGE_PATH" ]; then
echo "Publishing package: $PACKAGE ($PACKAGE_PATH)"

wally publish --project-path $PACKAGE_PATH
else
echo "Skipping: $PACKAGE_PATH does not exist"
fi
done