fixing workflow5 #7
Workflow file for this run
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: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [x86_64-unknown-linux-gnu, x86_64-apple-darwin, aarch64-apple-darwin, x86_64-pc-windows-gnu] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
target: ${{ matrix.target }} | |
override: true | |
- name: Install Dependencies | |
if: matrix.target == 'x86_64-pc-windows-gnu' | |
run: sudo apt-get install -y mingw-w64 | |
- name: Build | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Package | |
run: | | |
if [ ${{ matrix.target }} == "x86_64-unknown-linux-gnu" ]; then | |
tar -czvf which-allowed-linux.tar.gz -C target/${{ matrix.target }}/release which-allowed; | |
echo "package_name=which-allowed-linux.tar.gz" >> $GITHUB_ENV; | |
elif [ ${{ matrix.target }} == "x86_64-apple-darwin" ]; then | |
tar -czvf which-allowed-macos-x86_64.tar.gz -C target/${{ matrix.target }}/release which-allowed; | |
echo "package_name=which-allowed-macos-x86_64.tar.gz" >> $GITHUB_ENV; | |
elif [ ${{ matrix.target }} == "aarch64-apple-darwin" ]; then | |
tar -czvf which-allowed-macos-aarch64.tar.gz -C target/${{ matrix.target }}/release which-allowed; | |
echo "package_name=which-allowed-macos-aarch64.tar.gz" >> $GITHUB_ENV; | |
elif [ ${{ matrix.target }} == "x86_64-pc-windows-gnu" ]; then | |
zip which-allowed-windows.zip target/${{ matrix.target }}/release/which-allowed.exe; | |
echo "package_name=which-allowed-windows.zip" >> $GITHUB_ENV; | |
fi | |
create_release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
upload_assets: | |
runs-on: ubuntu-latest | |
needs: [build, create_release] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Upload Linux Asset | |
if: env.package_name == 'which-allowed-linux.tar.gz' | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: which-allowed-linux.tar.gz | |
asset_name: which-allowed-linux.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload macOS x86_64 Asset | |
if: env.package_name == 'which-allowed-macos-x86_64.tar.gz' | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: which-allowed-macos-x86_64.tar.gz | |
asset_name: which-allowed-macos-x86_64.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload macOS aarch64 Asset | |
if: env.package_name == 'which-allowed-macos-aarch64.tar.gz' | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: which-allowed-macos-aarch64.tar.gz | |
asset_name: which-allowed-macos-aarch64.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload Windows Asset | |
if: env.package_name == 'which-allowed-windows.zip' | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: which-allowed-windows.zip | |
asset_name: which-allowed-windows.zip | |
asset_content_type: application/zip |