ci: more sacrifices for the yaml gods #6
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-please | |
on: | |
push: | |
branches: [main] | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
if: ${{ !env.ACT }} | |
with: | |
command: manifest | |
outputs: | |
catwalk_release: ${{ steps.release.outputs['packages/catwalk--release_created'] || env.ACT }} | |
catwalk_name: ${{ steps.release.outputs['packages/catwalk--release_name'] }} | |
upload-catwalk: | |
name: Upload Catwalk for ${{ matrix.os }} | |
needs: release-please | |
runs-on: ${{ matrix.os }} | |
if: ${{ needs.release-please.outputs.catwalk_release }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
env: | |
MEMBER: catppuccin-catwalk | |
EXECUTABLE: catwalk | |
EXE_SUFFIX: ${{ matrix.os == 'windows-latest' && '.exe' || '' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('./Cargo.lock') }} | |
- name: Build | |
run: | | |
cargo build --release --locked -p ${MEMBER} | |
cargo test --release --locked -p ${MEMBER} | |
- name: Rename the binary | |
id: rename | |
run: | | |
export TRIPLE="$(rustc --version --verbose | grep host | cut -d ' ' -f 2)" | |
mv target/release/${EXECUTABLE}${EXE_SUFFIX} "./${EXECUTABLE}-${TRIPLE}" | |
echo "::set-output name=binary::${EXECUTABLE}-${TRIPLE}" | |
- name: Upload to release | |
run: gh release upload "${{ needs.release-please.outputs.catwalk_name }}" ${{ steps.rename.outputs.binary }} | |
if: ${{ !env.ACT }} | |
- name: Upload to artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{steps.rename.outputs.binary}} | |
path: ${{steps.rename.outputs.binary}} | |
if: ${{ env.ACT }} |