Skip to content

Merge pull request #886 from rust-embedded/settings #198

Merge pull request #886 from rust-embedded/settings

Merge pull request #886 from rust-embedded/settings #198

Workflow file for this run

name: release
on:
push:
branches:
- master
tags:
- v*.*.*
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
suffix: ".gz"
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
suffix: ".gz"
- os: macos-latest
target: x86_64-apple-darwin
suffix: ".gz"
- os: macos-latest
target: aarch64-apple-darwin
suffix: ".gz"
- os: windows-latest
target: x86_64-pc-windows-msvc
suffix: ".exe"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install Dependencies
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: sudo apt install -y gcc-aarch64-linux-gnu
- run: cargo build --target ${{ matrix.target }} --release
- name: Compress and rename executable
if: ${{ matrix.os != 'windows-latest' }}
run: gzip -c target/${{ matrix.target }}/release/svd2rust > svd2rust-${{ matrix.target }}${{ matrix.suffix }}
- name: Rename executable
if: ${{ matrix.os == 'windows-latest' }}
run: mv target/${{ matrix.target }}/release/svd2rust${{ matrix.suffix }} svd2rust-${{ matrix.target }}${{ matrix.suffix }}
- uses: actions/upload-artifact@v3
with:
name: svd2rust-${{ matrix.target }}
path: svd2rust-${{ matrix.target }}${{ matrix.suffix }}
release:
name: release
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
path: artifacts
- run: ls -R ./artifacts
- name: Set current date as environment variable
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- id: changelog-reader
uses: mindsers/changelog-reader-action@v2.2.2
with:
version: ${{ (github.ref_type == 'tag' && github.ref_name) || 'Unreleased' }}
- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.changelog-reader.outputs.version }}
name: ${{ (github.ref_type == 'tag' && steps.changelog-reader.outputs.version) || format('Prereleased {0}', env.CURRENT_DATE) }}
body: ${{ steps.changelog-reader.outputs.changes }}
prerelease: ${{ steps.changelog-reader.outputs.status == 'unreleased' }}
files: |
artifacts/**/*