Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix release pipeline #286

Merged
merged 2 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
No longer build manpage in build scripts
Instead, build manpage only as part of the release process to include it
in the release artifacts, and document how to build it during packaing.

This finally removes the OUT_DIR dependency for the release pipeline,
which simplifies and fixes the release pipeline.

Closes GH-284
  • Loading branch information
swsnr committed Jul 28, 2024
commit c796ceaaa320fda9dfa645a8ca8a85b47faf61c8
11 changes: 4 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ jobs:
if: ${{ !contains(matrix.target, 'windows') }}
- run: sudo apt-get install musl-tools
if: ${{ contains(matrix.target, 'linux-musl') }}
- shell: bash
id: build
run: |
OUTDIR="$(cargo build --locked --target '${{ matrix.target }}' ${{ matrix.cargo_opts }} --release --message-format=json-render-diagnostics |
jq -r 'select(.out_dir) | select(.package_id | startswith("mdcat ")) | .out_dir')"
echo "outdir=$OUTDIR" >>"$GITHUB_OUTPUT"
- run: cargo build --locked --target '${{ matrix.target }}' ${{ matrix.cargo_opts }} --release
- run: asciidoctor -b manpage -a reproducible mdcat.1.adoc
if: ${{ !contains(matrix.target, 'windows') }}
- run: strip 'target/${{ matrix.target }}/release/mdcat'
if: ${{ !contains(matrix.target, 'windows') }}
- id: version
Expand All @@ -42,7 +39,7 @@ jobs:
echo "version=$(cargo pkgid | cut -d'#' -f2 | cut -d: -f2)" >>"${GITHUB_OUTPUT}"
- id: package
shell: bash
run: ./scripts/package '${{ steps.version.outputs.version }}' '${{ matrix.target }}' '${{ steps.build.outputs.outdir }}'
run: ./scripts/package '${{ steps.version.outputs.version }}' '${{ matrix.target }}'
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.package.outputs.name }}
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ Use `cargo release` to create a new release.
- Update dependencies.

### Removed
- mdcat now longer builds shell completions during compilation (see [GH-286]).
- mdcat now longer builds shell completions and man pages during compilation (see [GH-286]).
- Packagers now need to build the manpage explicitly during packaging.
- Release artifacts no longer contain completions; use `mdcat --completions` to generate them instead (see [GH-286]).

### Fixed
- Restore binary release artifacts (see [GH-284])

[GH-284]: https://github.com/swsnr/mdcat/issues/284
[GH-286]: https://github.com/swsnr/mdcat/pull/286

## [2.2.0] – 2024-07-11
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,10 @@ Try `mdcat --help` or read the [mdcat(1)](./mdcat.1.adoc) manpage.

Run `cargo build --release`.
The resulting `mdcat` executable links against the system's SSL library, i.e. openssl on Linux.

To build a self-contained executable use `cargo build --features=static`; the resulting executable uses a pure Rust SSL implementation.
It still uses the system's CA roots however.

The build process also generates the following additional files in `$OUT_DIR`:

- A `mdcat.1` manpage, build from `mdcat.1.adoc` with the `asciidoctor` command from [AsciiDoctor].
If `asciidoctor` is not found the build script prints a warning.

These additional artifacts are included in the release builds.
If you package mdcat you may want to include these files too.

You may also want to include an `mdless` link to `mdcat` (see above).

[AsciiDoctor]: https://asciidoctor.org/

## Packaging

When packaging `mdcat` you may wish to include the following additional artifacts:
Expand All @@ -105,6 +94,17 @@ When packaging `mdcat` you may wish to include the following additional artifact
$ mdless --completions zsh > /usr/share/zsh/site-functions/_mdless
```

- A build of the man page `mdcat.1.adoc`, using [AsciiDoctor]:

```console
$ asciidoctor -b manpage -a reproducible -o /usr/share/man/man1/mdcat.1 mdcat.1.adoc
$ gzip /usr/share/man/man1/mdcat.1
# If you include a mdless as above, you may also want to support man mdless
$ ln -s mdcat.1.gz /usr/share/man/man1/mdless.1.gz
```

[AsciiDoctor]: https://asciidoctor.org/

## Troubleshooting

`mdcat` can output extensive tracing information when asked to.
Expand Down
46 changes: 0 additions & 46 deletions build.rs

This file was deleted.

3 changes: 1 addition & 2 deletions scripts/package
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ set -exuo pipefail

VERSION="$1"
TARGET="$2"
OUTDIR="$3"

ARCHIVE_NAME="mdcat-${VERSION}-${TARGET}"

Expand Down Expand Up @@ -37,7 +36,7 @@ package_unix() {
cp -r \
README.md CHANGELOG.md LICENSE \
"target/${TARGET}/release/mdcat" \
"${OUTDIR}/mdcat.1" \
"mdcat.1" \
"${pkg_dir}/${ARCHIVE_NAME}"
tar -czf "${PWD}/${archive_file}" -C "${pkg_dir}" "${ARCHIVE_NAME}"
echo "file=${archive_file}" >>"${GITHUB_OUTPUT}"
Expand Down