Skip to content

Build and upload release (linux) #26

Build and upload release (linux)

Build and upload release (linux) #26

Workflow file for this run

name: Build and upload release (linux)
on:
release:
types: [created]
env:
APP_NAME: gdrive
ARCHIVE_NAME: gdrive_linux-x64.tar.gz
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare upload url
run: |
UPLOAD_URL="$(jq -r '.release.upload_url' "$GITHUB_EVENT_PATH" | sed -e "s/{?name,label}$/?name=${ARCHIVE_NAME}/")"
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV
- name: Build application
run: |
docker run --rm -t -v $HOME/.cargo/registry/:/root/.cargo/registry -v "$(pwd)":/volume clux/muslrust:stable cargo build --release
- name: Create archive
run: |
tar -czf $ARCHIVE_NAME -C target/x86_64-unknown-linux-musl/release $APP_NAME
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ${{ env.ARCHIVE_NAME }}
asset_name: ${{ env.ARCHIVE_NAME }}
asset_content_type: application/gzip