Merge pull request #237 from rust-embedded/register-map #123
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: | |
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@v4 | |
- name: Install Rust toolchain | |
run: rustup target add ${{ matrix.target }} | |
- 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@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/[email protected] | |
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/**/* |