Skip to content

Commit e4b6ba3

Browse files
Merge #608
608: ci: add date and changelog to pre-release r=burrbull a=duskmoon314 - Compress binaries for Linux and MacOS - Extract the corresponding section in CHANGELOG and attach it to the release - Add the date to the title Co-authored-by: Campbell He <campbell.he@icloud.com>
2 parents ce19d4c + 2069f1e commit e4b6ba3

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
include:
1515
- os: ubuntu-latest
1616
target: x86_64-unknown-linux-gnu
17-
suffix: ""
17+
suffix: ".gz"
1818
- os: macos-latest
1919
target: x86_64-apple-darwin
20-
suffix: ""
20+
suffix: ".gz"
2121
- os: macos-latest
2222
target: aarch64-apple-darwin
23-
suffix: ""
23+
suffix: ".gz"
2424
- os: windows-latest
2525
target: x86_64-pc-windows-msvc
2626
suffix: ".exe"
@@ -41,32 +41,43 @@ jobs:
4141
with:
4242
command: build
4343
args: --target ${{ matrix.target }} --release
44+
45+
- name: Compress and rename executable
46+
if: ${{ matrix.os != 'windows-latest' }}
47+
run: gzip -c target/${{ matrix.target }}/release/svd2rust > svd2rust-${{ matrix.target }}${{ matrix.suffix }}
4448
- name: Rename executable
45-
run: mv target/${{ matrix.target }}/release/svd2rust${{ matrix.suffix }} target/${{ matrix.target }}/release/svd2rust-${{ matrix.target }}${{ matrix.suffix }}
49+
if: ${{ matrix.os == 'windows-latest' }}
50+
run: mv target/${{ matrix.target }}/release/svd2rust${{ matrix.suffix }} svd2rust-${{ matrix.target }}${{ matrix.suffix }}
51+
4652
- uses: actions/upload-artifact@v3
4753
with:
4854
name: svd2rust-${{ matrix.target }}
49-
path: target/${{ matrix.target }}/release/svd2rust-${{ matrix.target }}${{ matrix.suffix }}
55+
path: svd2rust-${{ matrix.target }}${{ matrix.suffix }}
5056

5157
release:
5258
name: release
5359
runs-on: ubuntu-latest
5460
needs: [build]
5561
steps:
62+
- uses: actions/checkout@v3
5663
- uses: actions/download-artifact@v3
5764
with:
5865
path: artifacts
5966
- run: ls -R ./artifacts
60-
- uses: softprops/action-gh-release@v1
61-
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
67+
68+
- name: Set current date as environment variable
69+
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
70+
71+
- id: changelog-reader
72+
uses: mindsers/changelog-reader-action@v2.0.0
6273
with:
63-
prerelease: true
64-
name: "Pre-release"
65-
tag_name: "pre-release"
66-
files: |
67-
artifacts/**/*
74+
version: ${{ (github.ref_type == 'tag' && github.ref_name) || 'Unreleased' }}
75+
6876
- uses: softprops/action-gh-release@v1
69-
if: startsWith(github.ref, 'refs/tags/v')
7077
with:
78+
tag_name: ${{ steps.changelog-reader.outputs.version }}
79+
name: ${{ (github.ref_type == 'tag' && steps.changelog-reader.outputs.version) || format('Prereleased {0}', env.CURRENT_DATE) }}
80+
body: ${{ steps.changelog-reader.outputs.changes }}
81+
prerelease: ${{ steps.changelog-reader.outputs.status == 'unreleased' }}
7182
files: |
7283
artifacts/**/*

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1212
- Use generic `FieldWriter`, `FieldReader`, `BitWriter`, `BitReader`
1313
- Disable two clippy warnings in `array_proxy.rs`
1414
- Add comments in docs about `readAction`
15-
- Add CI to build and release binaries
15+
- Add CI to build and release binaries, use `CHANGELOG.md` as the description
1616
- Optional use `derive_more::{Deref,From}` for register reader & writer
1717
- Don't use prebuilt strategy in CI
1818

0 commit comments

Comments
 (0)