Skip to content

Merge pull request #155 from rust-embedded/newrelease #41

Merge pull request #155 from rust-embedded/newrelease

Merge pull request #155 from rust-embedded/newrelease #41

Workflow file for this run

name: release
on:
push:
branches:
- master
tags:
- v*.*.*
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, suffix: .gz }
- { target: x86_64-apple-darwin, os: macos-latest, suffix: .gz }
- { target: aarch64-apple-darwin, os: macos-latest, suffix: .gz }
- { target: x86_64-pc-windows-msvc, os: windows-latest, suffix: .zip }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: ${{ matrix.target }}
override: true
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.target }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }} --release
- name: (Not Windows) Move executables and compress
if: ${{ matrix.os != 'windows-latest' }}
run: gzip -c target/${{ matrix.target }}/release/svdtools > svdtools-${{ matrix.target }}${{ matrix.suffix }}
- name: (Windows) Move executables and compress
if: ${{ matrix.os == 'windows-latest' }}
run: Compress-Archive -Path target\${{ matrix.target }}\release\svdtools.exe -DestinationPath svdtools-${{ matrix.target }}${{ matrix.suffix }}
- uses: actions/upload-artifact@v3
with:
name: svdtools-${{ matrix.target }}
path: svdtools-${{ matrix.target }}${{ matrix.suffix }}
release:
name: release
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3
- 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.0.0
with:
path: ./CHANGELOG-rust.md
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/**/*