Skip to content

Commit

Permalink
ci: auto release
Browse files Browse the repository at this point in the history
  • Loading branch information
tutinoko2048 committed Aug 9, 2024
1 parent 6877c1f commit 64918db
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Create Release

on:
push:
branches:
- release

jobs:
create_release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Read package version
id: version
run: |
previous_version=$(git describe --tags --abbrev=0)
current_version=$(node -p -e "require('./package.json').version")
if [ "$previous_version" = "v$current_version" ]; then
echo "Error: Version has not changed since the last release."
exit 1
fi
echo "::set-output name=version::$current_version"
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.version }}
release_name: Release v${{ steps.version.outputs.version }}
draft: false
prerelease: false

- name: Build updater for Windows
run: npm run build-updater-windows

- name: Upload updater for Windows
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/bds-updater-windows.exe
asset_name: bds-updater-windows.exe
asset_content_type: application/octet-stream

- name: Build updater for Linux
run: npm run build-updater-linux

- name: Upload updater for Linux
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/bds-updater-linux
asset_name: bds-updater-linux
asset_content_type: application/octet-stream
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "bun run src/launcher/index.ts",
"updater": "bun run src/updater/index.ts",
"build-launcher": "bun build src/launcher/index.ts --compile --outfile build/BedrockServerLauncher",
"build-installer": "bun build src/updater/index.ts --compile --outfile build/BedrockServerInstaller"
"build-updater-windows": "bun build src/updater/index.ts --minify --compile --target=bun-windows-x64 --outfile build/bds-updater-windows",
"build-updater-linux": "bun build src/updater/index.ts --minify --compile --target=bun-linux-x64 --outfile build/bds-updater-linux"
},
"devDependencies": {
"@types/bun": "latest",
Expand Down

0 comments on commit 64918db

Please sign in to comment.