feat(workflow): enhance release workflows with version tagging and dependency management
- Added steps to clone necessary dependencies in the Linux release workflow, ensuring all components are available for the build. - Implemented version setting from Git tags in both Linux and macOS workflows, improving version management consistency. - Updated the build script to extract and set the version from the YAO_VERSION environment variable, enhancing clarity in version handling. - Streamlined artifact creation steps to ensure proper versioning and organization of release artifacts. Made-with: Cursor
This commit is contained in:
parent
2eca43f1c5
commit
ee48f3a946
3 changed files with 53 additions and 3 deletions
41
.github/workflows/release-linux.yml
vendored
41
.github/workflows/release-linux.yml
vendored
|
|
@ -37,7 +37,39 @@ jobs:
|
|||
- name: Build
|
||||
run: |
|
||||
export PATH=$PATH:/github/home/go/bin
|
||||
/app/build.sh
|
||||
|
||||
# Clone dependencies
|
||||
cd /app
|
||||
git clone https://github.com/yaoapp/kun.git /app/kun
|
||||
git clone https://github.com/yaoapp/xun.git /app/xun
|
||||
git clone https://github.com/yaoapp/gou.git /app/gou
|
||||
git clone https://github.com/yaoapp/v8go.git /app/v8go
|
||||
git clone https://github.com/yaoapp/cui.git /app/cui-v1.0
|
||||
git clone https://github.com/yaoapp/yao-init.git /app/yao-init
|
||||
git clone https://github.com/yaoapp/yao.git /app/yao
|
||||
|
||||
# Extract libv8
|
||||
files=$(find /app/v8go -name "libv8*.zip")
|
||||
for file in $files; do
|
||||
dir=$(dirname "$file")
|
||||
echo "Extracting $file to directory $dir"
|
||||
unzip -o -d $dir $file
|
||||
rm -rf $dir/__MACOSX
|
||||
done
|
||||
|
||||
# Set VERSION from git tag (required)
|
||||
cd /app/yao
|
||||
if [[ "$GITHUB_REF" != refs/tags/v* ]]; then
|
||||
echo "::error::This workflow requires a tag (refs/tags/v*). Got: $GITHUB_REF"
|
||||
exit 1
|
||||
fi
|
||||
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
|
||||
echo "Setting VERSION to $TAG_VERSION"
|
||||
sed -i "s/const VERSION = \".*\"/const VERSION = \"${TAG_VERSION}\"/g" share/const.go
|
||||
grep 'const VERSION' share/const.go
|
||||
|
||||
make tools && make artifacts-linux
|
||||
mv /app/yao/dist/release/* /data/
|
||||
ls -l /data
|
||||
|
||||
- name: Push To R2
|
||||
|
|
@ -66,8 +98,13 @@ jobs:
|
|||
- name: Get Version
|
||||
id: version
|
||||
run: |
|
||||
VERSION=$(grep 'const VERSION =' share/const.go | awk '{print $4}' | sed 's/"//g')
|
||||
if [[ "$GITHUB_REF" != refs/tags/v* ]]; then
|
||||
echo "::error::This workflow requires a tag (refs/tags/v*). Got: $GITHUB_REF"
|
||||
exit 1
|
||||
fi
|
||||
VERSION="${GITHUB_REF#refs/tags/v}"
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "VERSION=${VERSION}"
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
|
|
|||
12
.github/workflows/release-macos.yml
vendored
12
.github/workflows/release-macos.yml
vendored
|
|
@ -93,6 +93,18 @@ jobs:
|
|||
- name: Checkout Yao
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set Version from Tag
|
||||
run: |
|
||||
if [[ "$GITHUB_REF" != refs/tags/v* ]]; then
|
||||
echo "::error::This workflow requires a tag (refs/tags/v*). Got: $GITHUB_REF"
|
||||
exit 1
|
||||
fi
|
||||
TAG="${GITHUB_REF#refs/tags/v}"
|
||||
echo "Setting VERSION to $TAG"
|
||||
sed -i.bak "s/const VERSION = \".*\"/const VERSION = \"${TAG}\"/g" share/const.go
|
||||
rm -f share/const.go.bak
|
||||
grep 'const VERSION' share/const.go
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
|
|
|
|||
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
|
|
@ -26,9 +26,10 @@ jobs:
|
|||
id: version
|
||||
run: |
|
||||
TAG="${{ github.event.workflow_run.head_branch }}"
|
||||
VERSION=$(grep 'const VERSION =' share/const.go | awk '{print $4}' | sed 's/"//g')
|
||||
VERSION="${TAG#v}"
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||
echo "TAG=${TAG} VERSION=${VERSION}"
|
||||
|
||||
- name: Wait for Both Workflows
|
||||
env:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue