Update artifact naming and adjust source/destination directories in w… #55
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 and Upload | |
on: [push] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
dir: musl | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
dir: windows | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
dir: macos | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install musl-tools (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get install -y musl-tools | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
target: ${{ matrix.target }} | |
- name: Cache cargo registry | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo index | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/git | |
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo build | |
uses: actions/cache@v2 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build project | |
run: cargo build --locked --release --target ${{ matrix.target }} --manifest-path binaries/geph5-client/Cargo.toml | |
- name: Move binaries to artifacts directory | |
run: | | |
mkdir -p artifacts/${{ matrix.dir }} | |
mv target/${{ matrix.target }}/release/geph5-client* artifacts/${{ matrix.dir }}/ | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.dir }} | |
path: artifacts/${{ matrix.dir }} | |
upload: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: artifacts | |
# - name: Prep and correct paths for upload | |
# run: | | |
# mv artifacts/musl/* artifacts/ | |
# mv artifacts/windows/* artifacts/ | |
# mv artifacts/macos/* artifacts/ | |
# rm -rf artifacts/musl artifacts/windows artifacts/macos | |
# shell: bash | |
- name: Upload to Cloudflare R2 | |
uses: ryand56/[email protected] | |
with: | |
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} | |
r2-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
r2-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
r2-bucket: geph5 | |
source-dir: artifacts | |
# Adjust 'destination-dir' as per need | |
destination-dir: ./ |