Fix Wrong nightly build releasebug (#2550) #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build on PR | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- release/* | |
jobs: | |
build-windows: | |
name: Build Windows Packages | |
runs-on: windows-2022 | |
steps: | |
- name: Prepare VC++ Runtime | |
run: choco install -y vcredist2017 | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.SACP_TOKEN }} | |
submodules: 'true' | |
- name: Checkout submodules | |
run: git submodule update --init --recursive | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: install | |
run: | | |
npm install -g npm@^9 | |
npm install | |
- name: build | |
run: npm run build | |
- name: Init Props | |
run: | | |
$PRODUCT_NAME="Snapmaker Luban" | |
$PACKAGE_NAME="Snapmaker-luban" | |
$PACKAGE_VERSION= node -e "console.log(require('./src/package.json').version)" | |
$RELEASE="$PACKAGE_NAME-$PACKAGE_VERSION" | |
echo "SM_RELEASE=$RELEASE" >> $env:GITHUB_ENV | |
# ---------------------------------------------------------------- | |
# Build Windows x64 | |
# ---------------------------------------------------------------- | |
- name: Build Windows x64 Binaries | |
run: | | |
npm run build:win-x64 | |
dir ${{ github.workspace }} | |
dir ${{ github.workspace }}/output | |
- name: Upload artifacts Windows x64 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.SM_RELEASE }}-win-x64.exe | |
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-win-x64.exe | |
- name: Deploy Windows release | |
uses: WebFreak001/deploy-nightly@v3.2.0 | |
with: | |
overwrite: true | |
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/190586441/assets{?name,label} | |
release_id: 190586441 | |
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-win-x64.exe | |
asset_name: ${{ env.SM_RELEASE }}-win-x64.exe | |
asset_content_type: application/octet-stream | |
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted | |
ignore_hash: true | |
build-macos: | |
name: Build macOS Packages | |
# macos-11.7 | |
runs-on: macos-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.SACP_TOKEN }} | |
submodules: 'true' | |
- name: Checkout submodules | |
run: git submodule update --init --recursive | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
# install setuptools to reintroduce distutils missing in Python 3.12 | |
# https://github.com/nodejs/node-gyp/issues/2869 | |
- run: pip install setuptools | |
- run: npm install -g npm@^9 | |
- run: npm install | |
- run: npm run build | |
- name: Init Props | |
run: | | |
PRODUCT_NAME="Snapmaker Luban" | |
PACKAGE_NAME="Snapmaker-luban" | |
PACKAGE_VERSION=`node -e "console.log(require('./src/package.json').version)"` | |
RELEASE=${PACKAGE_NAME}-${PACKAGE_VERSION} | |
echo "SM_RELEASE=$RELEASE" >> $GITHUB_ENV | |
# ---------------------------------------------------------------- | |
# Build macOS x64 & arm64 | |
# ---------------------------------------------------------------- | |
- name: Build macOS Binaries | |
run: npm run build:mac | |
env: | |
CSC_LINK: ${{ secrets.CSC_LINK_MACOS }} | |
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD_MACOS }} | |
APPLEID: ${{ secrets.APPLEID }} | |
APPLEIDPASS: ${{ secrets.APPLEIDPASS }} | |
# Mac arm64 | |
#dmg | |
- name: Upload artifacts mac-arm64-dmg | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.SM_RELEASE }}-mac-arm64.dmg | |
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-mac-arm64.dmg | |
- name: Deploy mac-arm64-dmg nightly | |
uses: WebFreak001/deploy-nightly@v3.2.0 | |
with: | |
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/190586441/assets{?name,label} | |
release_id: 190586441 | |
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-mac-arm64.dmg | |
asset_name: ${{ env.SM_RELEASE }}-mac-arm64.dmg | |
asset_content_type: application/octet-stream | |
max_releases: 1 | |
ignore_hash: true | |
# zip | |
- name: Upload artifacts mac-arm64-zip | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.SM_RELEASE }}-mac-arm64.zip | |
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-mac-arm64.zip | |
- name: Deploy mac-arm64-zip nightly | |
uses: WebFreak001/deploy-nightly@v3.2.0 | |
with: | |
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/190586441/assets{?name,label} | |
release_id: 190586441 | |
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-mac-arm64.zip | |
asset_name: ${{ env.SM_RELEASE }}-mac-arm64.zip | |
asset_content_type: application/octet-stream | |
max_releases: 1 | |
ignore_hash: true | |
# Mac x64 | |
#dmg | |
- name: Upload artifacts mac-x64-dmg | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.SM_RELEASE }}-mac-x64.dmg | |
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-mac-x64.dmg | |
- name: Deploy mac-x64-dmg nightly | |
uses: WebFreak001/deploy-nightly@v3.2.0 | |
with: | |
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/190586441/assets{?name,label} | |
release_id: 190586441 | |
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-mac-x64.dmg | |
asset_name: ${{ env.SM_RELEASE }}-mac-x64.dmg | |
asset_content_type: application/octet-stream | |
max_releases: 1 | |
ignore_hash: true | |
# zip | |
- name: Upload artifacts mac-x64-zip | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.SM_RELEASE }}-mac-x64.zip | |
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-mac-x64.zip | |
- name: Deploy mac-x64-dmg nightly | |
uses: WebFreak001/deploy-nightly@v3.2.0 | |
with: | |
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/190586441/assets{?name,label} | |
release_id: 190586441 | |
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-mac-x64.zip | |
asset_name: ${{ env.SM_RELEASE }}-mac-x64.zip | |
asset_content_type: application/octet-stream | |
max_releases: 1 | |
ignore_hash: true | |
build-linux: | |
name: Build Linux Packages | |
# Ubuntu 20.04: ubuntu-latest or ubuntu-20.04 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.SACP_TOKEN }} | |
submodules: 'true' | |
- name: Checkout submodules | |
run: git submodule update --init --recursive | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: npm install -g npm@^9 | |
- run: npm install | |
- run: npm run build | |
# ---------------------------------------------------------------- | |
# Build Linux x64 | |
# ---------------------------------------------------------------- | |
- name: Build Linux x64 Binaries | |
run: npm run build:linux-x64 | |
- run: | | |
PRODUCT_NAME="Snapmaker Luban" | |
PACKAGE_NAME="Snapmaker-luban" | |
PACKAGE_VERSION=`node -e "console.log(require('./src/package.json').version)"` | |
RELEASE=${PACKAGE_NAME}-${PACKAGE_VERSION} | |
echo "SM_RELEASE=$RELEASE" >> $GITHUB_ENV | |
ln -sf ./output/linux-unpacked "${RELEASE}-linux-x64" | |
tar zcfh "./output/${RELEASE}-linux-x64.tar.gz" "${RELEASE}-linux-x64" | |
rm -f "${RELEASE}-linux-x64" | |
# amd64-deb | |
- name: Upload artifacts linux-deb | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.SM_RELEASE }}-linux-amd64.deb | |
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-linux-amd64.deb | |
- name: Deploy Linux-deb nightly | |
uses: WebFreak001/deploy-nightly@v3.2.0 | |
with: | |
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/190586441/assets{?name,label} | |
release_id: 190586441 | |
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-linux-amd64.deb | |
asset_name: ${{ env.SM_RELEASE }}-linux-amd64.deb | |
asset_content_type: application/octet-stream | |
max_releases: 1 | |
ignore_hash: true | |
# x86_64.rpm | |
- name: Upload artifacts linux-rpm | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.SM_RELEASE }}-linux.x86_64.rpm | |
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-linux.x86_64.rpm | |
- name: Deploy Linux-rpm nightly | |
uses: WebFreak001/deploy-nightly@v3.2.0 | |
with: | |
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/190586441/assets{?name,label} | |
release_id: 190586441 | |
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-linux.x86_64.rpm | |
asset_name: ${{ env.SM_RELEASE }}-linux.x86_64.rpm | |
asset_content_type: application/octet-stream | |
max_releases: 1 | |
ignore_hash: true | |
# x64.tar.gz | |
- name: Upload artifacts linux-tar | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.SM_RELEASE }}-linux-x64.tar.gz | |
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-linux-x64.tar.gz | |
- name: Deploy Linux-tar nightly | |
uses: WebFreak001/deploy-nightly@v3.2.0 | |
with: | |
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/190586441/assets{?name,label} | |
release_id: 190586441 | |
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-linux-x64.tar.gz | |
asset_name: ${{ env.SM_RELEASE }}-linux-x64.tar.gz | |
asset_content_type: application/octet-stream | |
max_releases: 1 | |
ignore_hash: true |