Skip to content

Commit 9104619

Browse files
committed
geochunk v1.0.0: Release official binaries
1 parent 57b5583 commit 9104619

4 files changed

Lines changed: 146 additions & 2 deletions

File tree

.github/workflows/ci-geochunk.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: CI for geochunk
2+
3+
# Controls when the action will run. Triggers the workflow on push or pull request
4+
# events but only for the master branch
5+
on:
6+
push:
7+
# Run on the master branch.
8+
branches: [main]
9+
# Build anything with an appropriate release tag.
10+
tags: ["geochunk_*"]
11+
paths:
12+
- "build-release"
13+
- ".github/workflows/ci-geochunk.yml"
14+
- "geochunk/**"
15+
pull_request:
16+
# Only run on pull requests against master.
17+
branches: [main]
18+
paths:
19+
- "build-release"
20+
- ".github/workflows/ci-geochunk.yml"
21+
- "geochunk/**"
22+
23+
defaults:
24+
run:
25+
# Run all steps in this working directory.
26+
working-directory: geochunk
27+
28+
jobs:
29+
# We run this job first, to create any GitHub release that we might need.
30+
# Creating a release can only be done once, so we need to split it out from
31+
# other jobs.
32+
create_release:
33+
name: Create release (if needed)
34+
runs-on: ubuntu-latest
35+
outputs:
36+
release_version: ${{ steps.extract_release_version.outputs.release_version }}
37+
upload_url: ${{ steps.create_release.outputs.upload_url }}
38+
steps:
39+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
40+
- uses: actions/checkout@v2
41+
- name: Extract release version
42+
id: extract_release_version
43+
run: |
44+
release_version="$(echo '${{ github.ref }}' | sed 's,^.*/\([^/]*\),\1,; s,^geochunk_,,; s,^v,,' )"
45+
echo Release version: $release_version
46+
echo "::set-output name=release_version::$release_version"
47+
- name: Extract release body from CHANGELOG.md
48+
id: extract_release_body
49+
if: ${{ startsWith(github.ref, 'refs/tags/geochunk_') }}
50+
# Use `clparse` to parse `CHANGELOG.md` and extract release notes.
51+
run: |
52+
curl -sLO https://github.com/marcaddeo/clparse/releases/download/0.8.0/clparse-0.8.0-x86_64-unknown-linux-musl.tar.gz
53+
tar xzf clparse*.tar.gz
54+
sudo cp clparse /usr/local/bin
55+
rm -rf clparse*
56+
clparse -f json CHANGELOG.md | \
57+
jq ".releases[] | select(.version == \"${{ steps.extract_release_version.outputs.release_version }}\") | { title: \"\", description: \"\", releases: [.] }" | \
58+
clparse - | \
59+
tail -n +3 > RELEASE_BODY.md
60+
- name: "Make release"
61+
id: create_release
62+
if: ${{ startsWith(github.ref, 'refs/tags/geochunk_') }}
63+
uses: actions/create-release@v1
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
with:
67+
tag_name: ${{ github.ref }}
68+
release_name: "geochunk ${{ steps.extract_release_version.outputs.release_version }}"
69+
body_path: geochunk/RELEASE_BODY.md
70+
71+
# We use a matrix to run our build on every supported platform.
72+
build:
73+
needs:
74+
- create_release
75+
76+
strategy:
77+
matrix:
78+
# target: Official name of system to compile for.
79+
# host: Official name of system doing the compiling.
80+
# cargo: Should we use regular cargo, or the cross wrapper for cross-compiling?
81+
# os: GitHub CI OS image to use on runner.
82+
include:
83+
- target: x86_64-unknown-linux-musl
84+
host: x86_64-unknown-linux-musl
85+
cargo: cross
86+
os: ubuntu-latest
87+
- target: x86_64-apple-darwin
88+
host: x86_64-apple-darwin
89+
cargo: cargo
90+
os: macos-latest
91+
- target: aarch64-apple-darwin
92+
host: x86_64-apple-darwin
93+
cargo: cargo
94+
os: macos-latest
95+
96+
runs-on: ${{ matrix.os }}
97+
98+
steps:
99+
- name: Install Rust toolchain
100+
uses: actions-rs/toolchain@v1
101+
with:
102+
profile: minimal
103+
# We track latest stable Rust instead of hardcoding it because it
104+
# virtually never breaks old code.
105+
toolchain: stable
106+
components: rustfmt, clippy
107+
target: ${{ matrix.target }}
108+
- uses: actions/checkout@v2
109+
- name: Test and build release
110+
id: build_release
111+
working-directory: .
112+
run: |
113+
export RELEASE_VERSION="${{ needs.create_release.outputs.release_version }}"
114+
./build-release geochunk ${{ matrix.target }} ${{ matrix.host }} ${{ matrix.cargo }}
115+
echo "::set-output name=release_file::$(echo geochunk_*.zip)"
116+
- name: Upload Release Asset
117+
if: ${{ startsWith(github.ref, 'refs/tags/geochunk_') }}
118+
uses: actions/upload-release-asset@v1
119+
env:
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
with:
122+
upload_url: ${{ needs.create_release.outputs.upload_url }}
123+
asset_path: ./${{ steps.build_release.outputs.release_file }}
124+
asset_name: ${{ steps.build_release.outputs.release_file }}
125+
asset_content_type: application/zip

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

geochunk/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - 2022-05-25
9+
10+
### Added
11+
12+
- Official 1.0.0 release, because this program has been used in production for years.
13+
- Binary builds for more platforms, including M1.
14+
15+
## [0.1.5] - 2017-10-20
16+
17+
### Fixed
18+
19+
- Improve documentation.

geochunk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "geochunk"
3-
version = "0.1.5"
3+
version = "1.0.0"
44
authors = ["Eric Kidd <git@randomhacks.net>"]
55
edition = "2018"
66

0 commit comments

Comments
 (0)