Added write permissions #421
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: Build | |
permissions: | |
contents: write | |
on: | |
push: | |
# only trigger on branches, not on tags | |
branches: '**' | |
tags: | |
- v[0-9]+.* | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- target: aarch64-apple-darwin | |
os: macos-latest | |
- target: aarch64-unknown-linux-gnu | |
os: ubuntu-latest | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
env: | |
TARGET: ${{ matrix.TARGET }} | |
OS: ${{ matrix.OS }} | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cargo cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
./target | |
key: build-cargo-registry-${{matrix.TARGET}} | |
- name: Install and configure dependencies | |
run: | | |
# dependencies are only needed on ubuntu as that's the only place where | |
# we make cross-compilation | |
if [[ $OS =~ ^ubuntu.*$ ]]; then | |
sudo apt-get install -qq crossbuild-essential-arm64 crossbuild-essential-armhf protobuf-compiler libprotobuf-dev | |
fi | |
# some additional configuration for cross-compilation on linux | |
cat >>~/.cargo/config <<EOF | |
[target.aarch64-unknown-linux-gnu] | |
linker = "aarch64-linux-gnu-gcc" | |
[target.aarch64-unknown-linux-musl] | |
linker = "aarch64-linux-gnu-gcc" | |
EOF | |
- name: Install rust target | |
run: rustup target add $TARGET | |
- name: Build Binary | |
run: cargo build --locked --release --target ${{ matrix.target }} | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{matrix.TARGET}} | |
path: | | |
target/$TARGET/release | |
create-release: | |
runs-on: ubuntu-latest | |
if: github.ref_type == 'tag' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: taiki-e/create-gh-release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
needs: [ build, create-release ] | |
runs-on: ubuntu-latest | |
if: github.ref_type == 'tag' | |
strategy: | |
matrix: | |
include: | |
- target: aarch64-apple-darwin | |
- target: aarch64-unknown-linux-gnu | |
- target: x86_64-unknown-linux-gnu | |
env: | |
TARGET: ${{ matrix.TARGET }} | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- name: Archive and upload | |
run: | | |
mkdir -p dist | |
cd dist | |
cp ../target/$TARGET/release/skate . | |
cp ../target/$TARGET/release/skatelet . | |
tar -cvf skate-$TARGET.tar.gz skate | |
tar -cvf skatelet-$TARGET.tar.gz skatelet | |
gh release upload ${{github.ref_name}} *.tar.gz |