Skip to content

Commit

Permalink
build: remove dependency on asset/ directory existence. (#51)
Browse files Browse the repository at this point in the history
* build: remove dependency on asset/ directory existence.

* docs: add comments explaining why we ignore cp errors
  • Loading branch information
chaosteil authored Mar 13, 2024
1 parent bbce9df commit d8c86ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- 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/
cp -r assets wasm/ || true # Try to copy, but ignore if it can't copy if source directory does not exist
- name: Package as a zip
working-directory: ./wasm
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
run: |
mkdir linux
cp target/x86_64-unknown-linux-gnu/release/${{ env.binary }} linux/
cp -r assets linux/
cp -r assets linux/ || true # Try to copy, but ignore if it can't copy if source directory does not exist
- name: Package as a zip
working-directory: ./linux
Expand Down Expand Up @@ -137,6 +137,7 @@ jobs:
run: |
mkdir windows
cp target/x86_64-pc-windows-msvc/release/${{ env.binary }}.exe windows/
mkdir assets -ea 0 # create the assets directory if it does not exist, it will get ignored in the zip if empty
cp -r assets windows/
- name: Package as a zip
Expand Down Expand Up @@ -186,7 +187,7 @@ jobs:
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/
cp -r assets ${{ env.binary }}.app/Contents/MacOS/ || true # Try to copy, but ignore if it can't copy if source directory does not exist
hdiutil create -fs HFS+ -volname "${{ env.binary }}" -srcfolder ${{ env.binary }}.app ${{ env.binary }}-macOS-intel.dmg
- name: Upload binaries to artifacts
Expand Down Expand Up @@ -232,7 +233,7 @@ jobs:
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/
cp -r assets ${{ env.binary }}.app/Contents/MacOS/ || true # Try to copy, but ignore if it can't copy if source directory does not exist
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
Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ This workflow runs on every tag.

It will build:
* For Linux and Windows, a .zip archive containing the executable and the `assets`.
* For macOS, a dmg image with a .app containing the assets.
* For wasm, a .zip archive with the wasm binary, the js bindings, an html file loading it, and the assets.
* For macOS, a dmg image with a .app containing the `assets`.
* For wasm, a .zip archive with the wasm binary, the js bindings, an html file loading it, and the `assets`.

If you don't want to target some of those platforms, you can remove the corresponding job from the file [release.yaml](./.github/workflows/release.yaml).

Expand Down Expand Up @@ -67,11 +67,8 @@ If you would like to use the GitHub workflows included here for your own project

1. The release workflow relies on the `index.html` file under `/wasm` for web builds
2. Make sure that the env variable `binary` ([release.yaml](.github/workflows/release.yaml#L10)) matches the name of your binary
3. In case your project doesn't have an `assets` folder
1. Either create one and put a `.gitkeep` file in it to be able to push it
2. Or remove the `cp -r assets` statements in the build jobs
4. Adapt the used toolchain if you are using nightly
5. In your GitHub repo's settings, under `Actions -> General` make sure "Read and Write permissions" is selected under "Workflow permissions" near the bottom. This fixes the error `Error: Resource not accessible by integration`.
3. Adapt the used toolchain if you are using nightly
4. In your GitHub repo's settings, under `Actions -> General` make sure "Read and Write permissions" is selected under "Workflow permissions" near the bottom. This fixes the error `Error: Resource not accessible by integration`.


### Publish on itch.io
Expand Down

0 comments on commit d8c86ea

Please sign in to comment.