Fix artifact download pattern #149
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: release | |
on: push | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
cli-builds: | |
strategy: | |
matrix: | |
os: [ubuntu, windows, macos] | |
arch: [x86_64] | |
include: | |
- os: macos | |
arch: arm | |
triple: aarch64-apple-darwin | |
runs-on: ${{ format('{0}-latest', matrix.os) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
if: ${{ matrix.triple == null }} | |
- uses: dtolnay/rust-toolchain@stable | |
if: ${{ matrix.triple }} | |
with: | |
target: ${{ matrix.triple }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build artifacts (cross-compile) | |
if: ${{ matrix.triple }} | |
run: | | |
cargo build -p ncsu_exam_calendar_cli --release --target ${{ matrix.triple }} | |
mv target/${{ matrix.triple }}/release/ncsu_exam_calendar_cli target/release/${{ matrix.arch }}-${{ matrix.os }}-ncsu_examc | |
- name: Build artifacts (windows) | |
if: ${{ matrix.triple == null && matrix.os == 'windows' }} | |
run: | | |
cargo build -p ncsu_exam_calendar_cli --release | |
move target\release\ncsu_exam_calendar_cli.exe target\release\${{ matrix.arch }}-${{ matrix.os }}-ncsu_examc.exe | |
- name: Build artifacts | |
if: ${{ matrix.triple == null && matrix.os != 'windows' }} | |
run: | | |
cargo build -p ncsu_exam_calendar_cli --release | |
mv target/release/ncsu_exam_calendar_cli target/release/${{ matrix.arch }}-${{ matrix.os }}-ncsu_examc | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.arch }}-${{ matrix.os }}-cli | |
path: | | |
target/${{ matrix.triple }}/release/${{ matrix.arch }}-${{ matrix.os }}-ncsu_examc | |
target/release/${{ matrix.arch }}-${{ matrix.os }}-ncsu_examc | |
target/release/${{ matrix.arch }}-${{ matrix.os }}-ncsu_examc.exe | |
retention-days: 1 | |
gui-builds: | |
strategy: | |
matrix: | |
os: [ubuntu, windows, macos] | |
arch: [x86_64] | |
include: | |
- os: macos | |
arch: arm | |
triple: aarch64-apple-darwin | |
runs-on: ${{ format('{0}-latest', matrix.os) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: awalsh128/cache-apt-pkgs-action@v1 | |
if: ${{ matrix.os == 'ubuntu' }} | |
with: | |
packages: binaryen \ | |
libwebkit2gtk-4.1-dev \ | |
libgtk-3-dev \ | |
libayatana-appindicator3-dev | |
- name: Download dependencies (mac) | |
if: ${{ matrix.os == 'mac' }} | |
run: | | |
brew install binaryen | |
- name: Download dependencies (windows) | |
if: ${{ matrix.os == 'windows' }} | |
run: | | |
choco install sed | |
iex "& {$(irm get.scoop.sh)} -RunAsAdmin" | |
scoop install main/binaryen | |
- uses: dtolnay/rust-toolchain@stable | |
if: ${{ matrix.triple == null }} | |
- uses: dtolnay/rust-toolchain@stable | |
if: ${{ matrix.triple }} | |
with: | |
target: ${{ matrix.triple }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Download dioxus | |
run: | | |
cargo install --git https://github.com/DioxusLabs/dioxus dioxus-cli | |
- name: Fix paths (windows) | |
if: ${{ matrix.os == 'windows' }} | |
run: | | |
sed -i 's;/;\\\\;g' desktop/Dioxus.toml # Filesystem paths... | |
- name: Build artifacts (cross-compile) | |
if: ${{ matrix.triple }} | |
run: | | |
dx bundle --bin ncsu_exam_calendar_desktop --release --target '${{ matrix.triple }}' | |
mv 'desktop/dist/bundle/macos/ncsu_exam_calendar_desktop.app' 'desktop/dist/bundle/macos/ncsu_exam_calendar_desktop_${{ matrix.triple }}.app' || true | |
- name: Build artifacts | |
if: ${{ matrix.triple == null }} | |
run: | | |
dx bundle --bin ncsu_exam_calendar_desktop --release | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.arch }}-${{ matrix.os }}-gui | |
path: | | |
desktop/dist/bundle/deb/*.deb | |
desktop/dist/bundle/appimage/*.AppImage | |
desktop/dist/bundle/macos/*.app | |
desktop/dist/bundle/dmg/*.dmg | |
desktop/dist/bundle/msi/*.msi | |
desktop/dist/bundle/nsis/*.exe | |
retention-days: 1 | |
release_info: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: RELEASE.txt | |
path: RELEASE.txt | |
retention-days: 1 | |
bundle: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [ | |
cli-builds, | |
gui-builds, | |
release_info | |
] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
pattern: '!RELEASE.txt' | |
- name: Unpack directories | |
run: | | |
find -printf "%TY-%Tm-%Td\t%s\t%p\n" | column -t | |
find -mindepth 2 -maxdepth 2 -type d -exec sh -c 'mv "$1"/* . && rmdir "$1"' shell {} \; | |
zip -r ncsu_exam_calendar_desktop.app.zip ncsu_exam_calendar_desktop.app | |
rm -rf ncsu_exam_calendar_desktop.app | |
- name: Calculate checksums | |
run: | | |
sha512sum * > sums.txt | |
- name: Move artifacts to subfolder | |
run: | | |
shopt -s extglob | |
mkdir artifacts | |
mv !(artifacts) artifacts | |
rm artifacts/RELEASE.txt | |
- uses: actions/download-artifact@v3 | |
with: | |
name: RELEASE.txt | |
- uses: softprops/action-gh-release@v1 | |
with: | |
files: artifacts/** | |
generate_release_notes: true | |
body_path: RELEASE.txt |