Skip to content

Commit

Permalink
fixed2csv v1.0.0: Release official binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
emk committed May 25, 2022
1 parent 42e8350 commit 57560a3
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 2 deletions.
125 changes: 125 additions & 0 deletions .github/workflows/ci-fixed2csv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: CI for fixed2csv

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
# Run on the master branch.
branches: [main]
# Build anything with an appropriate release tag.
tags: ["fixed2csv_*"]
paths:
- "build-release"
- ".github/workflows/ci-fixed2csv.yml"
- "fixed2csv/**"
pull_request:
# Only run on pull requests against master.
branches: [main]
paths:
- "build-release"
- ".github/workflows/ci-fixed2csv.yml"
- "fixed2csv/**"

defaults:
run:
# Run all steps in this working directory.
working-directory: fixed2csv

jobs:
# We run this job first, to create any GitHub release that we might need.
# Creating a release can only be done once, so we need to split it out from
# other jobs.
create_release:
name: Create release (if needed)
runs-on: ubuntu-latest
outputs:
release_version: ${{ steps.extract_release_version.outputs.release_version }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Extract release version
id: extract_release_version
run: |
release_version="$(echo '${{ github.ref }}' | sed 's,^.*/\([^/]*\),\1,; s,^fixed2csv_,,; s,^v,,' )"
echo Release version: $release_version
echo "::set-output name=release_version::$release_version"
- name: Extract release body from CHANGELOG.md
id: extract_release_body
if: ${{ startsWith(github.ref, 'refs/tags/fixed2csv_') }}
# Use `clparse` to parse `CHANGELOG.md` and extract release notes.
run: |
curl -sLO https://github.com/marcaddeo/clparse/releases/download/0.8.0/clparse-0.8.0-x86_64-unknown-linux-musl.tar.gz
tar xzf clparse*.tar.gz
sudo cp clparse /usr/local/bin
rm -rf clparse*
clparse -f json CHANGELOG.md | \
jq ".releases[] | select(.version == \"${{ steps.extract_release_version.outputs.release_version }}\") | { title: \"\", description: \"\", releases: [.] }" | \
clparse - | \
tail -n +3 > RELEASE_BODY.md
- name: "Make release"
id: create_release
if: ${{ startsWith(github.ref, 'refs/tags/fixed2csv_') }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: "fixed2csv ${{ steps.extract_release_version.outputs.release_version }}"
body_path: fixed2csv/RELEASE_BODY.md

# We use a matrix to run our build on every supported platform.
build:
needs:
- create_release

strategy:
matrix:
# target: Official name of system to compile for.
# host: Official name of system doing the compiling.
# cargo: Should we use regular cargo, or the cross wrapper for cross-compiling?
# os: GitHub CI OS image to use on runner.
include:
- target: x86_64-unknown-linux-musl
host: x86_64-unknown-linux-musl
cargo: cross
os: ubuntu-latest
- target: x86_64-apple-darwin
host: x86_64-apple-darwin
cargo: cargo
os: macos-latest
- target: aarch64-apple-darwin
host: x86_64-apple-darwin
cargo: cargo
os: macos-latest

runs-on: ${{ matrix.os }}

steps:
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
# We track latest stable Rust instead of hardcoding it because it
# virtually never breaks old code.
toolchain: stable
components: rustfmt, clippy
target: ${{ matrix.target }}
- uses: actions/checkout@v2
- name: Test and build release
id: build_release
working-directory: .
run: |
export RELEASE_VERSION="${{ needs.create_release.outputs.release_version }}"
./build-release fixed2csv ${{ matrix.target }} ${{ matrix.host }} ${{ matrix.cargo }}
echo "::set-output name=release_file::$(echo fixed2csv_*.zip)"
- name: Upload Release Asset
if: ${{ startsWith(github.ref, 'refs/tags/fixed2csv_') }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./${{ steps.build_release.outputs.release_file }}
asset_name: ${{ steps.build_release.outputs.release_file }}
asset_content_type: application/zip
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions fixed2csv/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2022-05-25

### Added

- Official 1.0.0 release, because this program has been used in production for years.
- Binary builds for more platforms, including M1.

## [0.1.0] - 2018-10-31

### Added

- Original release.
7 changes: 6 additions & 1 deletion fixed2csv/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
[package]
name = "fixed2csv"
version = "0.1.0"
version = "1.0.0"
authors = ["Eric Kidd <git@randomhacks.net>"]
edition = "2018"

description = "Convert files with fixed-width columns to CSV"
license = "MIT/Apache-2.0"
readme = "README.md"
repository = "https://github.com/faradayio/csv-tools"
homepage = "https://github.com/faradayio/csv-tools/tree/main/fixed2csv"

[dependencies]
csv = "1.0.2"
Expand Down

0 comments on commit 57560a3

Please sign in to comment.