Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
JamyGolden committed Feb 22, 2024
1 parent ad56456 commit b64d028
Show file tree
Hide file tree
Showing 2 changed files with 244 additions and 13 deletions.
217 changes: 217 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
name: Release
on:
workflow_dispatch:
inputs:
tag_version:
description: 'Tag Version for Manual Release'
required: true
# push:
# tags:
# - "v*.*.*"
env:
CARGO_INCREMENTAL: 0
permissions:
contents: write

jobs:
publish_dryrun:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.tag_version || github.ref }}

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Cache Cargo registry
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Cache Cargo binaries
uses: actions/cache@v2
with:
path: |
~/.cargo/bin
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}

- name: Install cargo-deny and cargo-about
run: |
cargo install --locked cargo-deny || true
cargo install --locked cargo-about || true
- name: Attempt a publish dryrun
run: |
make publish_dry
release:
needs: publish_dryrun
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- prefix: x86_64-linux
target: x86_64-unknown-linux-gnu
os: ubuntu-latest
cross: false
deb: false
- prefix: i686-linux
target: i686-unknown-linux-gnu
os: ubuntu-latest
cross: true
deb: true
- prefix: aarch64-linux
target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
deb: true
- os: macos-11
target: x86_64-apple-darwin
cross: true
deb: false
- os: macos-11
target: aarch64-apple-darwin
cross: true
deb: false

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.tag_version || github.ref }}

- name: Get version
id: get_version
uses: SebRollen/toml-action@v1.2.0
with:
file: Cargo.toml
field: package.version

- name: Abort if there is a version/tag mismatch
run: |
if [[ "v${{ steps.get_version.outputs.value }}" != "${{ github.event.inputs.tag_version || github.ref }}" ]]; then
echo "There is a Cargo.toml package.version and git tag mismatch." && exit 1;
fi
# Main branch to get required assets that may not be available in
# previous releases
- uses: actions/checkout@v4
with:
ref: main
path: main-branch
# Fetch notes from CHANGELOG.md based on cargo.toml version
- name: Extract release notes
id: extract_notes
run: |
VERSION="${{ steps.get_version.outputs.value }}"
CHANGELOG_TEXT=$(sed -n "/## \[$VERSION\] /,/^## /p" "main-branch/CHANGELOG.md" | sed '1d;$d')
if [[ -n "$CHANGELOG_TEXT" ]]; then
echo "CHANGELOG_TEXT<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG_TEXT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
fi
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}

- name: Setup cache
uses: Swatinem/rust-cache@v2.7.3
with:
key: ${{ matrix.target }}

- name: Build binary
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release --locked --target=${{ matrix.target }} --color=always --verbose

- name: Install cargo-deb
if: ${{ matrix.deb == true }}
uses: actions-rs/install@v0.1
with:
crate: cargo-deb

- name: Build deb
if: ${{ matrix.deb == true }}
uses: actions-rs/cargo@v1
with:
command: deb
args: --no-build --no-strip --output=. --target=${{ matrix.target }}

- name: Package
shell: bash
run: |
files="example.toml license.html LICENSE README.md"
files_to_include=""
release_dir="$GITHUB_WORKSPACE/target/${{ matrix.target }}/release"
for file in $files; do
if [ ! -e "$file" ]; then
continue
fi
if [[ "$file" == "example.toml" ]]; then
cp "example.toml" "$release_dir/config.toml"
files_to_include+="config.toml "
continue
fi
cp "$file" "$release_dir/$file"
files_to_include+="$file "
done
build_dir="$GITHUB_WORKSPACE/build"
mkdir "$build_dir"
tar -cv -C "$release_dir" tinty $files_to_include | gzip --best > \
"$build_dir/tinty-${{ steps.get_version.outputs.value }}-${{ matrix.target }}.tar.gz"
shasum -a 256 "$build_dir/tinty-${{ steps.get_version.outputs.value }}-${{ matrix.target }}.tar.gz" > \
"$build_dir/tinty-${{ steps.get_version.outputs.value }}-${{ matrix.target }}.sha256"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: |
*.deb
*.tar.gz
*.sha256
- name: Create release
uses: softprops/action-gh-release@v1
with:
files: |
build/*.deb
build/*.tar.gz
build/*.sha256
tag_name: v${{ steps.get_version.outputs.value }}
name: Release ${{ steps.get_version.outputs.value }}
draft: true
body: ${{ steps.extract-release-notes.outputs.release_notes || env.CHANGELOG_TEXT }}

# - name: Cleanup
# run: rm -r build/

# - name: Publish to crates.io
# env:
# CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
# run: cargo publish
40 changes: 27 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,86 @@
# Changelog

## 0.10.1 (2024-02-20)
## [0.10.1] - 2024-02-20

- Fix bug where spaces in config or data directory paths would cause
`install` and `update` to fail
- Fix bug so now tinty works without a `config.toml` file being provided

## 0.10.0 (2024-02-19)
## [0.10.0] - 2024-02-19

- **Breaking**: Change `--config` flag to accept a path to config file
and not a directory containing a `config.toml`
- Add `--data-dir` flag to allow for manually setting data directory

## 0.9.0 (2024-02-18)
## [0.9.0] - 2024-02-18

- **Breaking**: `set` subcommand renamed to `apply`
- **Breaking**: `setup` subcommand renamed to `install`

## 0.8.1 (2024-02-17)
## [0.8.1] - 2024-02-17

- Fix visual `tinty info` spacing bug

## 0.8.0 (2024-02-17)
## [0.8.0] - 2024-02-17

- Add `info` subcommand to list scheme metadata as well as scheme colors

## 0.7.0 (2024-02-16)
## [0.7.0] - 2024-02-16

- Add `current` subcommand to print the last scheme name set.

## 0.6.0 (2024-02-15)
## [0.6.0] - 2024-02-15

- Change config.toml properties to use dashes instead of underscores.
Properties changes are:
- `default_theme` => `default_theme`
- `themes_dir` => `themes-dir`
- `supported_systems` => `supported-systems`

## 0.5.0 (2024-02-14)
## [0.5.0] - 2024-02-14

- Change `config.toml` `items.system` to `items.supported_systems` which
now accepts an array of strings instead of a string. This allows for
using a single template repo for setting both base16 and base24
themes.

## 0.4.0 (2024-02-11)
## [0.4.0] - 2024-02-11

- Enforces config.toml `[[items]]` `name` property is a unique value to
prevent dirname conflicts
- Removes config.toml `[[items]]` `git_url` property
- Adds config.toml `[[items]]` `path` property which supports git URLs
as well as path to local repo dir

## 0.3.0 (2024-02-10)
## [0.3.0] - 2024-02-10

- Add support for base24 templates

## 0.2.1 (2024-02-08)
## [0.2.1] - 2024-02-08

- Fix bug where `tinty --version` displays incorrect version number

## 0.2.0 (2024-02-07)
## [0.2.0] - 2024-02-07

- Generate `tinty list` from local version of
https://github.com/tinted-theming/schemes/base16
- `tinty list` now displays schemes prepended by their `system`.
`ocean` -> `base16-ocean`

## 0.1.0 (2024-02-06)
## [0.1.0] - 2024-02-06

- Initial release

[0.10.1]: https://github.com/tinted-theming/tinty/compare/v0.10.0...v0.10.1
[0.10.0]: https://github.com/tinted-theming/tinty/compare/v0.9.0...v0.10.0
[0.9.0]: https://github.com/tinted-theming/tinty/compare/v0.8.1...v0.9.0
[0.8.1]: https://github.com/tinted-theming/tinty/compare/v0.8.0...v0.8.1
[0.8.0]: https://github.com/tinted-theming/tinty/compare/v0.7.0...v0.8.0
[0.7.0]: https://github.com/tinted-theming/tinty/compare/v0.6.0...v0.7.0
[0.6.0]: https://github.com/tinted-theming/tinty/compare/v0.5.0...v0.6.0
[0.5.0]: https://github.com/tinted-theming/tinty/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/tinted-theming/tinty/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/tinted-theming/tinty/compare/v0.2.1...v0.3.0
[0.2.1]: https://github.com/tinted-theming/tinty/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/tinted-theming/tinty/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/tinted-theming/tinty/releases/tag/v0.1.0

0 comments on commit b64d028

Please sign in to comment.