From aa6ce5d0529d0676c8f165c77c54db2afceb10f2 Mon Sep 17 00:00:00 2001 From: Petter Rasmussen Date: Thu, 25 Aug 2022 09:36:13 +0300 Subject: [PATCH] Add workflow for building linux release --- .github/workflows/release_linux.yaml | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/release_linux.yaml diff --git a/.github/workflows/release_linux.yaml b/.github/workflows/release_linux.yaml new file mode 100644 index 0000000..d54f10c --- /dev/null +++ b/.github/workflows/release_linux.yaml @@ -0,0 +1,44 @@ +name: Build and upload release (linux) + +on: + release: + types: [created] + +env: + APP_NAME: poly + ARCHIVE_NAME: poly_linux-x64.tar.gz + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install latest rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + override: true + + - 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: | + cargo build --release + tar -czf $ARCHIVE_NAME -C target/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