Skip to content

Commit

Permalink
➕ Add release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajaniraiyn committed Jan 28, 2023
1 parent 4169518 commit 5851893
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: release

on:
release:
types: [published]

jobs:
create-release:
name: ${{ matrix.name }}

runs-on: ${{ matrix.os }}

strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest

include:
- os: ubuntu-latest
name: Linux Binary 64-Bit
target: x86_64-unknown-linux-musl

- os: macos-latest
name: MacOS Binary 64-Bit
target: x86_64-apple-darwin
target2: aarch64-apple-darwin

- os: windows-latest
name: Windows Binary 64-Bit
target: x86_64-pc-windows-msvc

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Add rustup default target
run: rustup target add ${{ matrix.target }}

- name: Add rustup Apple ARM64 target
if: ${{ matrix.os == 'macos-latest' }}
run: rustup target add ${{ matrix.target2 }}

- name: Build default target in release mode
run: cargo build --release --target ${{ matrix.target }} --locked

- name: Build Apple ARM64 target in release mode
if: ${{ matrix.os == 'macos-latest' }}
run: cargo build --release --target ${{ matrix.target2 }} --locked

- name: Create zip file on Windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
choco install zip
cd target/${{ matrix.target }}/release
zip upm-${{ env.GITHUB_REF }}-${{ matrix.target }}.zip upm.exe
cd ../../..
- name: Create tar.gz file on macOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
chmod +x target/${{ matrix.target }}/release/upm
tar -zcf target/${{ matrix.target }}/release/upm-${{ env.GITHUB_REF }}-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release upm
chmod +x target/${{ matrix.target2 }}/release/upm
tar -zcf target/${{ matrix.target2 }}/release/upm-${{ env.GITHUB_REF }}-${{ matrix.target2 }}.tar.gz -C target/${{ matrix.target2 }}/release upm
- name: Create tar.gz file on Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
chmod +x target/${{ matrix.target }}/release/upm
tar -zcf target/${{ matrix.target }}/release/upm-${{ env.GITHUB_REF }}-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release upm
- name: Upload release and assets to GitHub
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
release_name: upm ${{ env.GITHUB_REF }}
file_glob: true
file: target/*/release/upm-${{ env.GITHUB_REF }}-*.{zip,tar.gz}

# will be added after pre-releases
# - name: Upload release to crates.io
# uses: katyo/publish-crates@v1
# if: ${{ matrix.os == 'ubuntu-latest' }}
# with:
# registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 comments on commit 5851893

Please sign in to comment.