Skip to content

Update release.yml (#187) #68

Update release.yml (#187)

Update release.yml (#187) #68

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
permissions:
contents: write
jobs:
build:
name: build
runs-on: ${{ matrix.os }}
env:
CARGO: cargo
# Emit backtraces on panics.
RUST_BACKTRACE: 1
strategy:
fail-fast: false
matrix:
include:
- build: linux
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
- build: linux
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-musl
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: macos
os: macos-latest
rust: stable
target: aarch64-apple-darwin
- build: win64-msvc
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
- build: win64-gnu
os: windows-latest
rust: stable-x86_64-gnu
target: x86_64-pc-windows-gnu
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- name: UBX2RNX Dependencies
if: matrix.build == 'linux'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev
- name: Build applications
shell: bash
run: |
CARGO_PROFILE_RELEASE_STRIP=symbols ${{ env.CARGO }} build \
--verbose \
--target ${{ matrix.target }} \
--all-features \
--release \
-p rinex-cli \
-p rnx2cggtts \
-p rnx2crx \
-p crx2rnx \
-p ublox-rnx
ls -lah target/${{ matrix.target }}/release
if [ "${{ matrix.os }}" = "windows-latest" ]; then
crx2rnx="target/${{ matrix.target }}/release/crx2rnx.exe"
rnx2crx="target/${{ matrix.target }}/release/rnx2crx.exe"
rinex-cli="target/${{ matrix.target }}/release/rinex-cli.exe"
rnx2cggtts="target/${{ matrix.target }}/release/rnx2cggtts.exe"
ublox-rnx="target/${{ matrix.target }}/release/ublox-rnx.exe"
else
crx2rnx="target/${{ matrix.target }}/release/crx2rnx"
rnx2crx="target/${{ matrix.target }}/release/rnx2crx"
rinex-cli="target/${{ matrix.target }}/release/rinex-cli"
rnx2cggtts="target/${{ matrix.target }}/release/rnx2cggtts"
ublox-rnx="target/${{ matrix.target }}/release/ublox-rnx"
fi
echo "CRX2RNX=$crx2rnx" >> $GITHUB_ENV
echo "RNX2CRX=$crx2rnx" >> $GITHUB_ENV
echo "RNXCLI=$rinex-cli" >> $GITHUB_ENV
echo "RNX2CGGTTS=$rnx2cggtts" >> $GITHUB_ENV
echo "UBX2RNX=$ublox-rnx" >> $GITHUB_ENV
- name: Determine archive name
shell: bash
run: |
echo "ARCHIVE=rinex-${{ github.ref_name }}-${{ matrix.target }}" >> $GITHUB_ENV
- name: Creating directory for archive
shell: bash
run: |
mkdir -p "$ARCHIVE"
cp {README.md,LICENSE-MIT,LICENSE-APACHE} "$ARCHIVE"/
cp target/${{ matrix.target }}/release/"$CRX2RNX" "$ARCHIVE"/
cp target/${{ matrix.target }}/release/"$RNX2CRX" "$ARCHIVE"/
cp target/${{ matrix.target }}/release/"$RNXCLI" "$ARCHIVE"/
cp target/${{ matrix.target }}/release/"$RNX2CGGTTS" "$ARCHIVE"/
cp target/${{ matrix.target }}/release/"$UBX2RNX" "$ARCHIVE"/
- name: Gzip archive (Unix)
shell: bash
if: matrix.os != 'windows-latest'
run: |
tar czf "$ARCHIVE.tar.gz" "$ARCHIVE"
shasum -a 256 "$ARCHIVE.tar.gz" > "$ARCHIVE.tar.gz.sha256"
echo "ASSET=$ARCHIVE.tar.gz" >> $GITHUB_ENV
echo "ASSET_SUM=$ARCHIVE.tar.gz.sha256" >> $GITHUB_ENV
- name: Zip archive (Windows)
shell: bash
if: matrix.os == 'windows-latest'
run: |
7z a "$ARCHIVE.zip" "$ARCHIVE"
certutil -hashfile "$ARCHIVE.zip" SHA256 > "$ARCHIVE.zip.sha256"
echo "ASSET=$ARCHIVE.zip" >> $GITHUB_ENV
echo "ASSET_SUM=$ARCHIVE.zip.sha256" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ASSET }}
path: |
${{ env.ASSET }}
${{ env.ASSET_SUM }}
release:
runs-on: ubuntu-latest
needs: ['build']
steps:
- name: Create Release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/create-release@v1
with:
draft: true
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}