Skip to content

Release

Release #36

Workflow file for this run

name: Release
on:
milestone:
types: [closed]
workflow_call:
workflow_dispatch:
jobs:
draft:
name: Draft
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- name: Date
id: date
run: |
CUR_DATE=`date +"%Y.%m.%d"`
echo "value=$CUR_DATE" >> "$GITHUB_OUTPUT"
- name: Title
id: title
env:
# https://docs.github.com/en/rest/issues/milestones?apiVersion=2022-11-28#get-a-milestone
TITLE: ${{ github.event_name == 'milestone' && format('{0} ({1})', github.event.milestone.title, steps.date.outputs.value) || steps.date.outputs.value }}
run: |
echo "value=$TITLE" >> "$GITHUB_OUTPUT"
- name: Page
id: release
uses: softprops/action-gh-release@v2
with:
draft: true
tag_name: ${{ (startsWith(github.ref, 'refs/tags/') && github.ref) || steps.date.outputs.value }}
name: ${{ steps.title.outputs.value }}
generate_release_notes: true
outputs:
url: ${{ steps.release.outputs.url }}
id: ${{ steps.release.outputs.id }}
upload_url: ${{ steps.release.outputs.upload_url }}
assets: ${{ steps.release.outputs.assets }}
build:
continue-on-error: true
name: Build
needs: draft
permissions:
contents: write
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-14
- ubuntu-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Deps
uses: ./.github/actions/tools-deps
- name: add target x86-64
if: runner.os == 'macOS'
continue-on-error: true
run: rustup target add x86_64-apple-darwin
- name: prepare names
id: names
shell: bash
run: |
echo "os=-${{ runner.os }}" >> "$GITHUB_OUTPUT"
echo "ext=${{ ((runner.os == 'Windows') && '.exe') || ' ' }}" >> "$GITHUB_OUTPUT"
echo "suffix=${{ (runner.os == 'Windows' && format('-{0}', runner.arch)) || format('-{0}-{1}', runner.os, runner.arch) }}" >> "$GITHUB_OUTPUT"
echo "full=${{ (runner.os == 'Windows' && format('-{0}.exe', runner.arch)) || format('-{0}-{1}', runner.os, runner.arch) }}" >> "$GITHUB_OUTPUT"
- name: prepare dir
shell: bash
run: mkdir -p target/upload
- name: symbolizer ${{ runner.os == 'macOS' && '(both targets)' || '' }}
id: symbolizer
continue-on-error: true
run: >-
cargo build --release -p=playdate-symbolize --bins
${{ runner.os == 'macOS' && '--target=x86_64-apple-darwin --target=aarch64-apple-darwin' || '' }}
- name: symbolizer to upload
if: steps.symbolizer.outcome == 'success' && runner.os != 'macOS'
shell: bash
run: |
cp target/release/pd-addr2line${{ steps.names.outputs.ext }} target/upload/pd-addr2line${{ steps.names.outputs.full }}
cp target/release/pd-symbolize-trace${{ steps.names.outputs.ext }} target/upload/pd-symbolize-trace${{ steps.names.outputs.full }}
cp target/release/pd-symbolize-crashlog${{ steps.names.outputs.ext }} target/upload/pd-symbolize-crashlog${{ steps.names.outputs.full }}
- name: pdtool ${{ runner.os == 'macOS' && '(both targets)' || '' }}
id: pdtool
continue-on-error: true
run: >-
cargo build --release --bin=pdtool
${{ runner.os == 'macOS' && '--target=x86_64-apple-darwin --target=aarch64-apple-darwin' || '' }}
- name: pdtool to upload
if: steps.pdtool.outcome == 'success' && runner.os != 'macOS'
shell: bash
run: cp target/release/pdtool${{ steps.names.outputs.ext }} target/upload/pdtool${{ steps.names.outputs.full }}
- name: bindgen
id: bindgen
continue-on-error: true
run: >-
cargo build --release --bin=pdbindgen --no-default-features
--features=cli,documentation,extra-codegen,logging,pretty-please,which-rustfmt,runtime
- name: bindgen to upload
if: steps.bindgen.outcome == 'success' && runner.os != 'macOS'
shell: bash
run: cp target/release/pdbindgen${{ steps.names.outputs.ext }} target/upload/pdbindgen${{ steps.names.outputs.full }}
- name: cargo
id: cargo
continue-on-error: true
run: cargo build --release --bin=cargo-playdate --all-features
- name: cargo to upload
if: steps.cargo.outcome == 'success' && runner.os != 'macOS'
shell: bash
run: cp target/release/cargo-playdate${{ steps.names.outputs.ext }} target/upload/cargo-playdate${{ steps.names.outputs.full }}
- name: merge universal
if: runner.os == 'macOS'
continue-on-error: true
run: |
lipo -create -output target/upload/pdtool${{ steps.names.outputs.os }} target/*/release/pdtool
lipo -create -output target/upload/pd-addr2line${{ steps.names.outputs.os }} target/*/release/pd-addr2line
lipo -create -output target/upload/pd-symbolize-trace${{ steps.names.outputs.os }} target/*/release/pd-symbolize-trace
lipo -create -output target/upload/pd-symbolize-crashlog${{ steps.names.outputs.os }} target/*/release/pd-symbolize-crashlog
- name: Upload Release Artifacts
uses: AButler/[email protected]
with:
release-id: ${{ needs.draft.outputs.id }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
files: target/upload/*
- name: Upload for next jobs
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
path: |
target/release/pdbindgen
target/release/cargo-playdate
if-no-files-found: warn
retention-days: 1
overwrite: false
build-universal:
continue-on-error: true
name: Build (macos-12)
needs: [build, draft]
permissions:
contents: write
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
- name: prepare dir
run: |
mkdir -p target/upload
mkdir -p target/download
- name: Download artifacts
continue-on-error: true
uses: actions/download-artifact@v4
with:
path: target/download/
- name: ls download dir
run: ls -R target/download
- name: bindgen
id: bindgen
continue-on-error: true
run: >-
cargo build --release --bin=pdbindgen
--features=cli,documentation,extra-codegen,logging,pretty-please,which-rustfmt,runtime
--no-default-features
# fallback: if build fails => upload downloaded build:
- if: steps.bindgen.outcome == 'failure'
continue-on-error: true
name: bindgen to upload
run: mv target/download/*/pdbindgen target/upload/pdbindgen-${{ runner.os }}-ARM64
- name: cargo
id: cargo
continue-on-error: true
run: |
cargo build --release --bin=cargo-playdate --all-features
# fallback: if build fails => upload downloaded build:
- if: steps.cargo.outcome == 'failure'
continue-on-error: true
name: cargo to upload
run: mv target/download/*/cargo-playdate target/upload/cargo-playdate-${{ runner.os }}-ARM64
- name: merge pdbindgen
id: bindgen_merge
if: steps.bindgen.outcome == 'success'
continue-on-error: true
run: lipo -create -output target/upload/pdbindgen-${{ runner.os }} target/release/pdbindgen target/download/*/pdbindgen
# fallback: if merge fails or skipped => try upload new build:
- if: steps.bindgen_merge.outcome != 'success'
continue-on-error: true
name: cargo to upload
run: mv target/release/pdbindgen target/upload/pdbindgen-${{ runner.os }}-${{ runner.arch }}
- name: merge cargo-playdate
id: cargo_merge
if: steps.cargo.outcome == 'success'
continue-on-error: true
run: lipo -create -output target/upload/cargo-playdate-${{ runner.os }} target/release/cargo-playdate target/download/*/cargo-playdate
# fallback: if merge fails or skipped => try upload new build:
- if: steps.cargo_merge.outcome != 'success'
continue-on-error: true
name: cargo to upload
run: mv target/release/cargo-playdate target/upload/cargo-playdate-${{ runner.os }}-${{ runner.arch }}
- name: Upload Release Artifacts
uses: AButler/[email protected]
with:
release-id: ${{ needs.draft.outputs.id }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
files: target/upload/*