Skip to content

Commit

Permalink
ci: add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
my4ng committed May 23, 2024
1 parent c76c31e commit d390339
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: Rust
name: Main

on: [push, workflow_dispatch, pull_request]

jobs:
check:
env:
RUSTFLAGS: "-D warnings"

runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Release

on:
push:
tags:
- "v*.*.*"

jobs:
build:
name: Build ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: tack-linux.tar.gz
- os: windows-latest
name: tack-windows.tar.gz
- os: macos-latest
name: tack-macos.tar.gz

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable

- name: Build
run: cargo build --release --locked

- name: Archive
if: matrix.name == 'windows'
run: 7z a ${{ matrix.name }} target/release/tac.exe README.md CONTRIBUTORS.md LICENSE-MIT LICENSE-APACHE

- name: Archive
if: matrix.name != 'windows'
run: tar czvf ${{ matrix.name }} target/release/tac README.md CONTRIBUTORS.md LICENSE-MIT LICENSE-APACHE

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}
if-no-files-found: error

release:
needs: build
name: Release
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4

- name: Release
uses: softprops/action-gh-release@v2
with:
files: tack-*
fail_on_unmatched_files: true

cargo-publish:
needs: release
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable

- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 comments on commit d390339

Please sign in to comment.