Skip to content

Commit

Permalink
GHA for publishing.
Browse files Browse the repository at this point in the history
  • Loading branch information
bladecoder committed Nov 27, 2023
1 parent ace4e1b commit e46b457
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Upload Rust Packages

on:
release:
types: [published]

permissions:
contents: write

jobs:
upload-binkplayer:
runs-on: ${{ matrix.os }}

strategy:
matrix:
build: [linux, windows, mac]
include:
- build: linux
os: ubuntu-latest
exec: binkplayer
platform: x86_64-linux
- build: macos
os: macos-latest
exec: binkplayer
platform: x86_64-macos
- build: windows
os: windows-latest
exec: binkplayer.exe
platform: x86_64-windows

steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build package
run: |
cargo build
- name: Upload binkplayer to Github release
run: |
staging="binkplayer-${{github.event.release.tag_name}}-${{ matrix.platform }}"
mkdir "$staging"
cp target/release/${{ matrix.exec }} "$staging/"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a "$staging.zip" "$staging"
gh release upload ${{github.event.release.tag_name}} "$staging.zip"
else
tar czf "$staging.tar.gz" "$staging"
gh release upload ${{github.event.release.tag_name}} "$staging.tar.gz"
fi
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
shell: bash
publish:
name: Publish package in crates.io
runs-on: ubuntu-latest
run: |
cargo publish -p bladeink --token ${CRATES_TOKEN}
cargo publish -p binkplayer --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}

0 comments on commit e46b457

Please sign in to comment.