Skip to content

Commit

Permalink
chore: Add first draft of a release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sondrelg committed Apr 11, 2023
1 parent 41c74b4 commit 5cc1d6f
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: release

on:
release:
types:
- created

jobs:
release:
name: release - ${{ matrix.platform.release_for }}
strategy:
matrix:
platform:
- release_for: linux-x86_64
os: ubuntu-20.04
target: x86_64-unknown-linux-musl
bin: printf-log-formatter
name: printf-log-formatter-linux-x86_64-musl.tar.gz

- release_for: windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
bin: printf-log-formatter.exe
name: printf-log-formatter-windows-x86_64.zip

- release_for: macos-x86_64
os: macOS-latest
target: x86_64-apple-darwin
bin: printf-log-formatter
name: printf-log-formatter-darwin-x86_64.tar.gz

- release_for: macos-aarch64
os: macOS-latest
target: aarch64-apple-darwin
bin: printf-log-formatter
name: printf-log-formatter-darwin-aarch64.tar.gz

runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.platform.target }}
- name: build binary
uses: houseabsolute/actions-rust-cross@v0
with:
target: ${{ matrix.platform.target }}
args: "--locked --release"
strip: true
- name: package as archive
shell: bash
run: |
cd target/${{ matrix.platform.target }}/release
if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then
7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
else
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
fi
cd -
- name: publish github release
uses: softprops/action-gh-release@v1
with:
draft: true
files: "printf-log-formatter-*"
body_path: Changes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: startsWith( github.ref, 'refs/tags/v' )

0 comments on commit 5cc1d6f

Please sign in to comment.