From cd132670fa43eea8ae711a60118b3b3f44bc856c Mon Sep 17 00:00:00 2001 From: --get-all Date: Thu, 15 Feb 2024 22:25:01 +0100 Subject: [PATCH] commit --- .github/workflows/github_pages.yaml | 19 -- .github/workflows/github_releases.yaml | 49 --- .github/workflows/itchio.yaml | 43 --- .github/workflows/linux.yaml | 56 ---- .github/workflows/macos.yaml | 103 ------ .github/workflows/release.yaml | 447 ++++++++++++++++--------- .github/workflows/web.yaml | 64 ---- .github/workflows/windows.yaml | 53 --- 8 files changed, 286 insertions(+), 548 deletions(-) delete mode 100644 .github/workflows/github_pages.yaml delete mode 100644 .github/workflows/github_releases.yaml delete mode 100644 .github/workflows/itchio.yaml delete mode 100644 .github/workflows/linux.yaml delete mode 100644 .github/workflows/macos.yaml delete mode 100644 .github/workflows/web.yaml delete mode 100644 .github/workflows/windows.yaml diff --git a/.github/workflows/github_pages.yaml b/.github/workflows/github_pages.yaml deleted file mode 100644 index 1bce6bb..0000000 --- a/.github/workflows/github_pages.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: Publish Github-Pages - -on: - workflow_call: - -jobs: - publish-github-pages: - name: github-pages - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - name: Setup Pages - uses: actions/configure-pages@v3 - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 \ No newline at end of file diff --git a/.github/workflows/github_releases.yaml b/.github/workflows/github_releases.yaml deleted file mode 100644 index a176cbd..0000000 --- a/.github/workflows/github_releases.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: Publish Github-Releases - -on: - workflow_call: - inputs: - tag: - required: true - type: string - os: - required: true - type: string - artifact_name: - required: true - type: string - -jobs: - github-releases: - name: ${{ inputs.artifact_name }} - runs-on: ${{ inputs.os }} - steps: - - uses: xSAVIKx/artifact-exists-action@v0 - id: check_artifact - with: - name: ${{ inputs.artifact_name }} - - - name: Download artifacts - if: steps.check_artifact.outputs.exists == 'true' - uses: actions/download-artifact@v3 - with: - name: ${{ inputs.artifact_name }} - path: ./artifact - - - name: Get file - if: steps.check_artifact.outputs.exists == 'true' - id: get_file_name - shell: bash - working-directory: ./artifact - run: | - ls -R - echo "file_name=$(ls | head -n 1)" >> "$GITHUB_OUTPUT" - - - name: Upload artifact to release - if: steps.check_artifact.outputs.exists == 'true' - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./artifact/${{ steps.get_file_name.outputs.file_name }} - tag: ${{ inputs.tag }} - overwrite: true \ No newline at end of file diff --git a/.github/workflows/itchio.yaml b/.github/workflows/itchio.yaml deleted file mode 100644 index 3811829..0000000 --- a/.github/workflows/itchio.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: Publish Itch.io - -on: - workflow_call: - inputs: - tag: - required: true - type: string - itchio_target: - required: true - type: string - -jobs: - publish-itchio: - name: itchio - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - path: ./builds - - - name: Install butler - run: | - curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default - unzip butler.zip - chmod +x butler - ./butler -V - - - name: Upload to itch.io - env: - BUTLER_API_KEY: ${{ secrets.BUTLER_CREDENTIALS }} - run: | - for channel in $(ls builds); do - if [ "$channel" = "github-pages" ]; then - continue - fi - ./butler push \ - --fix-permissions \ - --userversion="${{ inputs.tag }}" \ - builds/$channel/* \ - ${{ inputs.itchio_target }}:$channel - done \ No newline at end of file diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml deleted file mode 100644 index b492f69..0000000 --- a/.github/workflows/linux.yaml +++ /dev/null @@ -1,56 +0,0 @@ -name: Build Linux - -on: - workflow_call: - inputs: - tag: - required: true - type: string - binary: - required: true - type: string - - -jobs: - github-releases: - name: linux - env: - platform: linux - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: dtolnay/rust-toolchain@stable - with: - targets: x86_64-unknown-linux-gnu - - - name: install dependencies - run: | - sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev - - - name: Build - run: | - cargo build --release --target x86_64-unknown-linux-gnu --no-default-features - - - name: Set file name - id: set_file_name - run: | - echo "file_name=${{ inputs.binary }}_${{ inputs.tag }}_${{ env.platform }}" >> "$GITHUB_OUTPUT" - - - name: Prepare package - run: | - mkdir linux - cp target/x86_64-unknown-linux-gnu/release/${{ inputs.binary }} linux/ - cp -r assets linux/ - - - name: Package as a zip - working-directory: ./linux - run: | - zip --recurse-paths ../${{ steps.set_file_name.outputs.file_name }}.zip . - - - name: Upload binaries to artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ env.platform }} - path: ${{ steps.set_file_name.outputs.file_name }}.zip - retention-days: 1 diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml deleted file mode 100644 index 45d08f9..0000000 --- a/.github/workflows/macos.yaml +++ /dev/null @@ -1,103 +0,0 @@ -name: Build MacOS - -on: - workflow_call: - inputs: - tag: - required: true - type: string - binary: - required: true - type: string - run_macos_intel: - required: true - type: string - run_macos_apple_silicon: - required: true - type: string - - -jobs: - build-macos-intel: - if: inputs.run_macos_intel == 'true' - name: macos_intel - env: - platform: macos_intel - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - - uses: dtolnay/rust-toolchain@stable - with: - targets: x86_64-apple-darwin - - - name: Environment Setup - run: | - export CFLAGS="-fno-stack-check" - export MACOSX_DEPLOYMENT_TARGET="10.9" - - - name: Build - run: | - cargo build --release --target x86_64-apple-darwin - - - name: Set Paths - id: set_paths - run: | - echo "file_name=${{ inputs.binary }}_${{ inputs.tag }}_${{ env.platform }}" >> "$GITHUB_OUTPUT" - echo "app_structure=${{ inputs.binary }}.app/Contents/MacOS" >> "$GITHUB_OUTPUT" - - - name: Prepare Package - run: | - mkdir -p ${{ steps.set_paths.outputs.app_structure }} - cp target/x86_64-apple-darwin/release/${{ inputs.binary }} ${{ steps.set_paths.outputs.app_structure }} - cp -r assets ${{ steps.set_paths.outputs.app_structure }} - hdiutil create -fs HFS+ -volname "${{ inputs.binary }}" -srcfolder ${{ inputs.binary }}.app ${{ steps.set_paths.outputs.file_name }}.dmg - - - name: Upload binaries to artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ env.platform }} - path: ${{ steps.set_paths.outputs.file_name }}.dmg - retention-days: 1 - - build-macos-apple-silicon: - name: macos_apple_silicon - if: inputs.run_macos_apple_silicon == 'true' - env: - platform: macos_apple_silicon - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - - uses: dtolnay/rust-toolchain@stable - with: - targets: aarch64-apple-darwin - - - name: Environment - # macos 11 was the first version to support ARM - run: | - export MACOSX_DEPLOYMENT_TARGET="11" - - - name: Build - run: | - cargo build --release --target aarch64-apple-darwin - - - name: Set paths - id: set_paths - run: | - echo "file_name=${{ inputs.binary }}_${{ inputs.tag }}_${{ env.platform }}" >> "$GITHUB_OUTPUT" - echo "app_structure=${{ inputs.binary }}.app/Contents/MacOS" >> "$GITHUB_OUTPUT" - - - name: Prepare Package - run: | - mkdir -p ${{ steps.set_paths.outputs.app_structure }} - cp target/aarch64-apple-darwin/release/${{ inputs.binary }} ${{ steps.set_paths.outputs.app_structure }} - cp -r assets ${{ steps.set_paths.outputs.app_structure }} - hdiutil create -fs HFS+ -volname "${{ inputs.binary }}" -srcfolder ${{ inputs.binary }}.app ${{ steps.set_paths.outputs.file_name }}.dmg - - - name: Upload binaries to artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ env.platform }} - path: ${{ steps.set_paths.outputs.file_name }}.dmg - retention-days: 1 \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 52b94a0..bff5ca8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,178 +1,303 @@ name: Release -# Configure your build and release platforms +on: + push: + tags: + - '*' + env: - # If your repo name differs from your binary name, change it. - # Check you Cargo.toml -> package -> name - binary: ${{ github.event.repository.name }} + # update with the name of the main binary + binary: bevy_platformer + add_binaries_to_github_release: true + itch_target: jullang/bevy-platformer - # Build platforms + # Before enabling LFS, please take a look at GitHub's documentation for costs and quota limits: + # https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-storage-and-bandwidth-usage + use_git_lfs: false - # Valid platforms: "web, linux, windows, macos_intel, macos_apple_silicon" - # - Write "intel" and "apple" to abbreviate "macos_intel" and "macos_apple_silicon," respectively. - # - Write "macos" to build for both "intel" and "apple" - # - Write "web" or "wasm" to build for the web - build_for: "web, linux, windows, macos" - # Releases +jobs: - # Valid platforms: "github_releases, itchio, github_pages" - # - For brevity you can write: "releases, itchio, pages" - publish_to: "releases, pages, itchio" + # Build for wasm + release-wasm: + runs-on: ubuntu-latest - # Itch.io configuration + steps: + - uses: olegtarasov/get-tag@v2.1.2 + id: get_version + - uses: actions/checkout@v4 + with: + lfs: ${{ env.use_git_lfs }} + - uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-unknown-unknown + - name: install wasm-bindgen-cli + run: | + cargo install wasm-bindgen-cli - # itchio_target is REQUIRED for publish to itch.io to work. - itchio_target: jullang/bevy-platformer - # Example of itchio_target: cart/build-a-better-buddy - # Check the url of your game page in itch.io + - name: Build + run: | + cargo build --release --target wasm32-unknown-unknown -permissions: - # To upload files to GitHub Releases - contents: write - # To deploy to Pages - pages: write - # To verify the deployment originates from an appropriate source - id-token: write + - name: Prepare package + run: | + wasm-bindgen --no-typescript --out-name bevy_game --out-dir wasm --target web target/wasm32-unknown-unknown/release/${{ env.binary }}.wasm + cp -r assets wasm/ -on: - push: - tags: - - "*" - workflow_dispatch: - inputs: - tag: - description: "Add tag version: (e.g. -> v3.6.1)" - required: true - type: string - build_for: - description: "Build for:" - default: web,linux,windows,macos - publish_to: - description: "Publish to:" - default: github_releases - itchio_target: - description: "Itchio target: /" - type: string + - name: Package as a zip + working-directory: ./wasm + run: | + zip --recurse-paths ../${{ env.binary }}.zip . -jobs: - # Load variables - load-env: + - name: Upload binaries to artifacts + uses: actions/upload-artifact@v3 + with: + path: ${{ env.binary }}.zip + name: wasm + retention-days: 1 + + - name: Upload binaries to release + if: ${{ env.add_binaries_to_github_release == 'true' }} + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ env.binary }}.zip + asset_name: ${{ env.binary }}-wasm-${{ steps.get_version.outputs.tag }}.zip + tag: ${{ github.ref }} + overwrite: true + + # Build for Linux + release-linux: runs-on: ubuntu-latest + + steps: + - uses: olegtarasov/get-tag@v2.1.2 + id: get_version + - uses: actions/checkout@v4 + with: + lfs: ${{ env.use_git_lfs }} + - uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-unknown-linux-gnu + - name: install dependencies + run: | + sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev + + - name: Build + run: | + cargo build --release --target x86_64-unknown-linux-gnu + + - name: Prepare package + run: | + mkdir linux + cp target/x86_64-unknown-linux-gnu/release/${{ env.binary }} linux/ + cp -r assets linux/ + + - name: Package as a zip + working-directory: ./linux + run: | + zip --recurse-paths ../${{ env.binary }}.zip . + + - name: Upload binaries to artifacts + uses: actions/upload-artifact@v3 + with: + path: ${{ env.binary }}.zip + name: linux + retention-days: 1 + + - name: Upload binaries to release + if: ${{ env.add_binaries_to_github_release == 'true' }} + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ env.binary }}.zip + asset_name: ${{ env.binary }}-linux-${{ steps.get_version.outputs.tag }}.zip + tag: ${{ github.ref }} + overwrite: true + + # Build for Windows + release-windows: + runs-on: windows-latest + + steps: + - uses: olegtarasov/get-tag@v2.1.2 + id: get_version + - uses: actions/checkout@v4 + with: + lfs: ${{ env.use_git_lfs }} + - uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-pc-windows-msvc + + - name: Build + run: | + cargo build --release --target x86_64-pc-windows-msvc + + - name: Prepare package + run: | + mkdir windows + cp target/x86_64-pc-windows-msvc/release/${{ env.binary }}.exe windows/ + cp -r assets windows/ + + - name: Package as a zip + run: | + Compress-Archive -Path windows/* -DestinationPath ${{ env.binary }}.zip + + - name: Upload binaries to artifacts + uses: actions/upload-artifact@v3 + with: + path: ${{ env.binary }}.zip + name: windows + retention-days: 1 + + - name: Upload binaries to release + if: ${{ env.add_binaries_to_github_release == 'true' }} + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ env.binary }}.zip + asset_name: ${{ env.binary }}-windows-${{ steps.get_version.outputs.tag }}.zip + tag: ${{ github.ref }} + overwrite: true + + # Build for MacOS x86_64 + release-macOS-intel: + runs-on: macOS-latest + steps: - - id: get_version - uses: olegtarasov/get-tag@v2.1.2 + - uses: olegtarasov/get-tag@v2.1.2 + id: get_version + - uses: actions/checkout@v4 + with: + lfs: ${{ env.use_git_lfs }} + - uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-apple-darwin + - name: Environment Setup + run: | + export CFLAGS="-fno-stack-check" + export MACOSX_DEPLOYMENT_TARGET="10.9" + + - name: Build + run: | + cargo build --release --target x86_64-apple-darwin + + - name: Prepare Package + run: | + mkdir -p ${{ env.binary }}.app/Contents/MacOS + cp target/x86_64-apple-darwin/release/${{ env.binary }} ${{ env.binary }}.app/Contents/MacOS/ + cp -r assets ${{ env.binary }}.app/Contents/MacOS/ + hdiutil create -fs HFS+ -volname "${{ env.binary }}" -srcfolder ${{ env.binary }}.app ${{ env.binary }}-macOS-intel.dmg + + - name: Upload binaries to artifacts + uses: actions/upload-artifact@v3 + with: + path: ${{ env.binary }}-macOS-intel.dmg + name: macOS-intel + retention-days: 1 + + - name: Upload binaries to release + if: ${{ env.add_binaries_to_github_release == 'true' }} + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ env.binary }}-macOS-intel.dmg + asset_name: ${{ env.binary }}-macOS-intel-${{ steps.get_version.outputs.tag }}.dmg + tag: ${{ github.ref }} + overwrite: true + + # Build for MacOS Apple Silicon + release-macOS-apple-silicon: + runs-on: macOS-latest + + steps: + - uses: olegtarasov/get-tag@v2.1.2 + id: get_version + - uses: actions/checkout@v4 + with: + lfs: ${{ env.use_git_lfs }} + - uses: dtolnay/rust-toolchain@stable + with: + targets: aarch64-apple-darwin + - name: Environment + # macOS 11 was the first version to support ARM + run: | + export MACOSX_DEPLOYMENT_TARGET="11" + + - name: Build + run: | + cargo build --release --target aarch64-apple-darwin + - name: Prepare Package + run: | + mkdir -p ${{ env.binary }}.app/Contents/MacOS + cp target/aarch64-apple-darwin/release/${{ env.binary }} ${{ env.binary }}.app/Contents/MacOS/ + cp -r assets ${{ env.binary }}.app/Contents/MacOS/ + hdiutil create -fs HFS+ -volname "${{ env.binary }}-macOS-apple-silicon" -srcfolder ${{ env.binary }}.app ${{ env.binary }}-macOS-apple-silicon.dmg + + - name: Upload binaries to artifacts + uses: actions/upload-artifact@v3 + with: + path: ${{ env.binary }}-macOS-apple-silicon.dmg + name: macOS-apple-silicon + retention-days: 1 + + - name: Upload binaries to release + if: ${{ env.add_binaries_to_github_release == 'true' }} + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ env.binary }}-macOS-apple-silicon.dmg + asset_name: ${{ env.binary }}-macOS-apple-silicon-${{ steps.get_version.outputs.tag }}.dmg + tag: ${{ github.ref }} + overwrite: true + + check-if-upload-to-itch-is-configured: + runs-on: ubuntu-latest outputs: - run_build_web: ${{ ( inputs.tag && (contains(inputs.build_for, 'web') || contains(inputs.build_for, 'wasm')) ) || ( !inputs.tag && (contains(env.build_for, 'web') || contains(env.build_for, 'wasm')) ) }} - run_build_linux: ${{ (inputs.tag && contains(inputs.build_for, 'linux')) || (!inputs.tag && contains(env.build_for, 'linux') ) }} - run_build_windows: ${{ ( inputs.tag && contains(inputs.build_for, 'windows')) || (!inputs.tag && contains(env.build_for, 'windows') ) }} - run_build_macos_intel: ${{ ( inputs.tag && ( contains(inputs.build_for, 'intel') || contains(inputs.build_for, 'macos') )) || (!inputs.tag && (contains(env.build_for, 'intel') || contains(env.build_for, 'macos')) ) }} - run_build_macos_apple_silicon: ${{ ( inputs.tag && ( contains(inputs.build_for, 'apple') || contains(inputs.build_for, 'macos') )) || (!inputs.tag && (contains(env.build_for, 'apple') || contains(env.build_for, 'macos')) ) }} - run_publish_github_releases: ${{ ( inputs.tag && contains(inputs.publish_to, 'releases')) || (!inputs.tag && contains(env.publish_to, 'releases') ) }} - run_publish_itchio: ${{ ( inputs.tag && contains(inputs.publish_to, 'itchio')) || (!inputs.tag && contains(env.publish_to, 'itchio') ) }} - run_publish_github_pages: ${{ ( inputs.tag && contains(inputs.publish_to, 'pages')) || (!inputs.tag && contains(env.publish_to, 'pages') ) }} - itchio_target: ${{ inputs.itchio_target || env.itchio_target }} - tag: ${{ ( inputs.tag || steps.get_version.outputs.tag ) }} - binary: ${{ env.binary }} - - # Build for Web/WASM - build-web: - needs: load-env - if: needs.load-env.outputs.run_build_web == 'true' - uses: ./.github/workflows/web.yaml - name: build - with: - tag: ${{ needs.load-env.outputs.tag }} - binary: ${{ needs.load-env.outputs.binary }} - run_publish_github_pages: ${{ needs.load-env.outputs.run_publish_github_pages }} - - # Build for Linux x86_64 - build-linux: - needs: load-env - if: needs.load-env.outputs.run_build_linux == 'true' - uses: ./.github/workflows/linux.yaml - name: build - with: - tag: ${{ needs.load-env.outputs.tag }} - binary: ${{ needs.load-env.outputs.binary }} - - # Build for Windows x86_64 - build-windows: - needs: load-env - if: needs.load-env.outputs.run_build_windows == 'true' - uses: ./.github/workflows/windows.yaml - name: build - with: - tag: ${{ needs.load-env.outputs.tag }} - binary: ${{ needs.load-env.outputs.binary }} - - - # Build for MacOS x86_64/ARM64 - build-macos: - needs: load-env - if: needs.load-env.outputs.run_build_macos_intel == 'true' || needs.load-env.outputs.run_build_macos_apple_silicon == 'true' - uses: ./.github/workflows/macos.yaml - name: build - with: - tag: ${{ needs.load-env.outputs.tag }} - binary: ${{ needs.load-env.outputs.binary }} - run_macos_intel: ${{ needs.load-env.outputs.run_build_macos_intel }} - run_macos_apple_silicon: ${{ needs.load-env.outputs.run_build_macos_apple_silicon }} - - - # Release binaries in GitHub - publish-github-releases: - needs: - - load-env - - build-web - - build-linux - - build-windows - - build-macos - if: ${{ always() && !failure() && !cancelled() && needs.load-env.outputs.run_publish_github_releases == 'true'}} - strategy: - fail-fast: false - matrix: - include: - - artifact_name: web - os: ubuntu-latest - - artifact_name: linux - os: ubuntu-latest - - artifact_name: windows - os: windows-latest - - artifact_name: macos_apple_silicon - os: macos-latest - - artifact_name: macos_intel - os: macos-latest - uses: ./.github/workflows/github_releases.yaml - name: publish / github-releases - with: - tag: ${{ needs.load-env.outputs.tag }} - os: ${{ matrix.os }} - artifact_name: ${{ matrix.artifact_name }} - secrets: inherit - - # Publish to Itch.io - publish-itchio: - needs: - - load-env - - build-web - - build-linux - - build-windows - - build-macos - if: ${{ always() && !failure() && !cancelled() && needs.load-env.outputs.run_publish_itchio == 'true' && needs.load-env.outputs.itchio_target != '' }} - uses: ./.github/workflows/itchio.yaml - name: publish - with: - tag: ${{ needs.load-env.outputs.tag }} - itchio_target: ${{ needs.load-env.outputs.itchio_target }} - secrets: inherit - - # Publish to GitHub Pages - publish-github-pages: + should-upload: ${{ steps.check-env.outputs.has-itch-target }} + steps: + - id: check-env + run: | + if [[ -z "$itch_target" ]]; then + echo "has-itch-target=no" >> $GITHUB_OUTPUT + else + echo "has-itch-target=yes" >> $GITHUB_OUTPUT + fi + + upload-to-itch: + runs-on: ubuntu-latest needs: - - load-env - - build-web - if: ${{ needs.load-env.outputs.run_publish_github_pages == 'true' }} - uses: ./.github/workflows/github_pages.yaml - name: publish + - check-if-upload-to-itch-is-configured + - release-wasm + - release-linux + - release-windows + - release-macOS-intel + - release-macOS-apple-silicon + if: ${{ needs.check-if-upload-to-itch-is-configured.outputs.should-upload == 'yes' }} + + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + path: ./builds + + - name: Install butler + run: | + curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default + unzip butler.zip + chmod +x butler + ./butler -V + - uses: olegtarasov/get-tag@v2.1.2 + id: get_version + - name: Upload to itch.io + env: + BUTLER_API_KEY: ${{ secrets.BUTLER_CREDENTIALS }} + run: | + for channel in $(ls builds); do + ./butler push \ + --fix-permissions \ + --userversion="${{ steps.get_version.outputs.tag }}" \ + builds/$channel/* \ + ${{ env.itch_target }}:$channel + done diff --git a/.github/workflows/web.yaml b/.github/workflows/web.yaml deleted file mode 100644 index 38e5d4b..0000000 --- a/.github/workflows/web.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: Build Web - -on: - workflow_call: - inputs: - tag: - required: true - type: string - binary: - required: true - type: string - run_publish_github_pages: - required: true - type: string - -jobs: - github-releases: - name: web - env: - platform: web - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: dtolnay/rust-toolchain@nightly - with: - targets: wasm32-unknown-unknown - - - name: install wasm-bindgen-cli - run: | - cargo install wasm-bindgen-cli - - - name: Build - run: | - cargo build --release --target wasm32-unknown-unknown --no-default-features - - - name: Set file name - id: set_file_name - run: | - echo "file_name=${{ inputs.binary }}_${{ inputs.tag }}_${{ env.platform }}" >> "$GITHUB_OUTPUT" - - - name: Prepare package - run: | - wasm-bindgen --no-typescript --out-name bevy_game --out-dir wasm --target web target/wasm32-unknown-unknown/release/${{ inputs.binary }}.wasm - cp -r assets wasm/ - - - name: Upload github-page to artifacts - if: inputs.run_publish_github_pages == 'true' - uses: actions/upload-pages-artifact@v2 - with: - path: ./wasm - retention-days: 1 - - - name: Package as a zip - working-directory: ./wasm - run: | - zip --recurse-paths ../${{ steps.set_file_name.outputs.file_name }}.zip . - - - name: Upload binaries to artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ env.platform }} - path: ${{ steps.set_file_name.outputs.file_name }}.zip - retention-days: 1 diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml deleted file mode 100644 index a16641a..0000000 --- a/.github/workflows/windows.yaml +++ /dev/null @@ -1,53 +0,0 @@ -name: Build Windows - -on: - workflow_call: - inputs: - tag: - required: true - type: string - binary: - required: true - type: string - - -jobs: - github-releases: - name: windows - env: - platform: windows - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - - uses: dtolnay/rust-toolchain@stable - with: - targets: x86_64-pc-windows-msvc - - - name: Build - run: | - cargo build --release --target x86_64-pc-windows-msvc - - - name: Set file name - id: set_file_name - shell: bash - run: | - echo "file_name=${{ inputs.binary }}_${{ inputs.tag }}_${{ env.platform }}" >> "$GITHUB_OUTPUT" - - - name: Prepare package - shell: bash - run: | - mkdir windows - cp target/x86_64-pc-windows-msvc/release/${{ inputs.binary }}.exe windows/ - cp -r assets windows/ - - - name: Package as a zip - run: | - Compress-Archive -Path windows/* -DestinationPath "${{ steps.set_file_name.outputs.file_name }}.zip" - - - name: Upload binaries to artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ env.platform }} - path: ${{ steps.set_file_name.outputs.file_name }}.zip - retention-days: 1 \ No newline at end of file