From d58dcc1c64034301f1ed3c660b3c986db317f1a8 Mon Sep 17 00:00:00 2001 From: connlost <4348524953.h@gmail.com> Date: Fri, 26 Apr 2024 19:43:12 +0800 Subject: [PATCH] Try Update GH Workflows --- .../{dev-release.yml => dev-build.yml} | 14 +++-- .github/workflows/release-build.yml | 54 +++++++++++++++++++ .github/workflows/release-ghcr.yml | 44 +++++++++++++++ 3 files changed, 107 insertions(+), 5 deletions(-) rename .github/workflows/{dev-release.yml => dev-build.yml} (82%) create mode 100644 .github/workflows/release-build.yml create mode 100644 .github/workflows/release-ghcr.yml diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-build.yml similarity index 82% rename from .github/workflows/dev-release.yml rename to .github/workflows/dev-build.yml index 6b5d470..8dfeb83 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-build.yml @@ -1,6 +1,10 @@ -name: Dev Release +name: Dev Build + +on: + push: + branches-ignore: + - release -on: [push] jobs: dev-release: strategy: @@ -13,7 +17,7 @@ jobs: uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.12.2 architecture: x64 @@ -34,7 +38,7 @@ jobs: run: ./build_executable.sh - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Palworld_Pal_Editor_${{ matrix.os }}_artifact - path: ./dist/ + path: ./dist/ \ No newline at end of file diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml new file mode 100644 index 0000000..e76175a --- /dev/null +++ b/.github/workflows/release-build.yml @@ -0,0 +1,54 @@ +name: Release Build + +on: + push: + branches: + - release + tags: + - "v*.*.*" + +jobs: + dev-release: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12.2 + architecture: x64 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Run Windows Builder Script + if: runner.os == 'Windows' + shell: pwsh + run: ./build_executable.ps1 + + - name: Run Unix-like Builder Script + if: runner.os != 'Windows' + shell: bash + run: ./build_executable.sh + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: Palworld_Pal_Editor_${{ matrix.os }}_artifact + path: ./dist/ + + - name: Create and Upload Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: dist/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release-ghcr.yml b/.github/workflows/release-ghcr.yml new file mode 100644 index 0000000..5c9b30a --- /dev/null +++ b/.github/workflows/release-ghcr.yml @@ -0,0 +1,44 @@ +name: Build and Push Docker image + +on: + push: + branches: + - release + tags: + - "v*.*.*" + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Lowercase repository owner + run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/${{ env.REPO_OWNER }}/palworld-pal-editor:latest + platforms: linux/amd64,linux/arm64 + + - name: Verify image digest + run: echo "The new image digest is ${{ steps.build-and-push.outputs.digest }}" \ No newline at end of file