Skip to content

Commit

Permalink
Add release workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
rcorre committed Nov 23, 2024
1 parent f025954 commit 53418f7
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 3 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release
on:
push:
branches: [ "release-test" ]
tags: [ '[0-9]+.[0-9]+*' ]

jobs:
build:
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
include:
- os: windows-latest
extension: .exe
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4

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

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

publish:
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Create Release
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir artifacts/archives
cd artifacts/ubuntu-latest
tar cJvf "../archives/pbls-$GITHUB_REF_NAME-linux.tar.xz" pbls
cd ../macos-latest
tar cJvf "../archives/pbls-$GITHUB_REF_NAME-macos.tar.xz" pbls
cd ../windows-latest
zip "../archives/pbls-$GITHUB_REF_NAME-windows.zip" pbls.exe
gh release create "$GITHUB_REF_NAME" --notes-from-tag ../archives/*
7 changes: 4 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,21 @@ env:

jobs:
build:

runs-on: ubuntu-latest

env:
RUST_LOG: pbls=trace
RUST_BACKTRACE: 1

steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Install protoc
run: |
curl https://github.com/protocolbuffers/protobuf/releases/download/v28.2/protoc-28.2-linux-x86_64.zip -Lo /tmp/protoc.zip
unzip /tmp/protoc.zip
bin/protoc --version
- name: Run tests
- name: Test
run: PATH="$PATH:bin/" cargo test --verbose
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[toolchain]
channel = "stable"
components = ["rustfmt", "rust-src", "clippy"]

0 comments on commit 53418f7

Please sign in to comment.