Skip to content

Commit

Permalink
ci: improve publishing release assets (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
maksym-arutyunyan authored Oct 1, 2024
1 parent 19a90d1 commit f6c82a8
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 43 deletions.
79 changes: 38 additions & 41 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Build and Release

name: Release
on:
release:
types: [published]
Expand All @@ -9,44 +8,42 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
architecture: [x86_64] # Since Rust doesn't natively target x86 for modern platforms, we're focusing on x86_64
include:
- os: ubuntu-20.04
name: linux64
asset_name: keepsorted-linux64
- os: macos-12
name: macos
asset_name: keepsorted-macos

steps:
# Step 1: Check out the repository
- name: Checkout code
uses: actions/checkout@v3

# Step 2: Install Rust
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

# Step 3: Build the project
- name: Build the project
run: cargo build --release --all-targets

# Step 4: Create a release binary file name
- name: Prepare release binary
run: |
mkdir -p release
cp target/release/keepsorted release/keepsorted-${{ matrix.os }}-${{ matrix.architecture }}
# Step 5: Compress the binary using tar.gz
- name: Tar the binary
run: |
tar -czvf keepsorted-${{ matrix.os }}-${{ matrix.architecture }}.tar.gz -C release keepsorted-${{ matrix.os }}-${{ matrix.architecture }}
# Step 6: Upload the tar.gz to the GitHub release
- name: Upload Release Assets
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./keepsorted-${{ matrix.os }}-${{ matrix.architecture }}.tar.gz
asset_name: keepsorted-${{ matrix.os }}-${{ matrix.architecture }}.tar.gz
asset_content_type: application/gzip

- uses: actions/checkout@v4

- name: Build
run: cargo build --release --all-targets

- name: Prepare Release Binary
run: |
mkdir -p release
cp target/release/keepsorted release/${{ matrix.asset_name }}
tar -czvf keepsorted-${{ matrix.asset_name }}.tar.gz -C release keepsorted-${{ matrix.asset_name }}
- name: Upload Compressed Release Asset (tar.gz)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./keepsorted-${{ matrix.asset_name }}.tar.gz
asset_name: keepsorted-${{ matrix.asset_name }}.tar.gz
asset_content_type: application/gzip

- name: Upload Original Binary
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./release/${{ matrix.asset_name }}
asset_name: keepsorted-${{ matrix.asset_name }}
asset_content_type: application/octet-stream
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ format and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

## [Unreleased]

- (add updates here)

## [0.1.1] - 2024-10-01

### Added

- Keep Rust derive tokens together, eg. `Serialize` and `serde::Serialize`
- (Experimental) Keep Rust derive tokens together, eg. `Serialize` and `serde::Serialize`

## [0.1.0] - 2024-09-12

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "keepsorted"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
description = "A tool for sorting blocks of lines in code files"
authors = ["Maksym Arutyunyan"]
Expand Down

0 comments on commit f6c82a8

Please sign in to comment.