Skip to content

Commit

Permalink
Merge pull request #231 from hougesen/ci/release-workflow
Browse files Browse the repository at this point in the history
ci: release workflow
  • Loading branch information
hougesen authored Jun 4, 2024
2 parents 741035e + e9d6031 commit b0ee7b3
Showing 1 changed file with 118 additions and 0 deletions.
118 changes: 118 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: release
on:
push:
tags: ['*']
workflow_dispatch:
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
release:
needs: [create-release]
strategy:
matrix:
include:
- os: windows-latest
artifact-name: mdsf-windows-x86_64
artifact-alias: mdsf-win64
cargo-target: x86_64-pc-windows-msvc
- os: ubuntu-20.04
artifact-name: mdsf-linux-x86_64
artifact-alias: mdsf-linux
cargo-target: x86_64-unknown-linux-gnu
- os: ubuntu-20.04
artifact-name: mdsf-linux-x86_64-musl
cargo-target: x86_64-unknown-linux-musl
#- os: ubuntu-20.04
# artifact-name: mdsf-linux-aarch64
# cargo-target: aarch64-unknown-linux-gnu
# linker: gcc-aarch64-linux-gnu
- os: macos-latest
artifact-name: mdsf-macos-x86_64
artifact-alias: mdsf-macos
cargo-target: x86_64-apple-darwin
- os: macos-latest
artifact-name: mdsf-macos-aarch64
cargo-target: aarch64-apple-darwin
name: Build (${{ matrix.artifact-name }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.cargo-target }}
- name: Install Linker packages
if: ${{ matrix.linker != '' }}
run: |
sudo apt update
sudo apt install ${{ matrix.linker }}
- name: Build Binary (All features)
run: cargo build --verbose --locked --release --target ${{ matrix.cargo-target }}
env:
CARGO_TARGET_DIR: output
- name: Setup Archive + Extension
shell: bash
run: |
mkdir -p staging
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp "output/${{ matrix.cargo-target }}/release/mdsf.exe" staging/
cd staging
7z a ../release.zip *
else
cp "output/${{ matrix.cargo-target }}/release/mdsf" staging/
cd staging
zip ../release.zip *
fi
- name: Upload Binary Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: release.zip
- name: Upload Binary to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: release.zip
asset_name: ${{ matrix.artifact-name }}.zip
asset_content_type: application/zip
# TODO: Remove this after deprecation notice
- name: Upload Binary to Release aliases
if: ${{ matrix.artifact-alias != '' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: release.zip
asset_name: ${{ matrix.artifact-alias }}.zip
asset_content_type: application/zip
release_cargo:
name: Publish to cargo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Publish hitt-formatter
run: cargo publish -p hitt-formatter --verbose --locked --token ${{ secrets.CARGO_TOKEN }}
- name: Publish hitt-parser
run: cargo publish -p hitt-parser --verbose --locked --token ${{ secrets.CARGO_TOKEN }}
- name: Publish hitt-request
run: cargo publish -p hitt-request --verbose --locked --token ${{ secrets.CARGO_TOKEN }}
- name: Publish hitt
run: cargo publish -p hitt --verbose --locked --token ${{ secrets.CARGO_TOKEN }}

0 comments on commit b0ee7b3

Please sign in to comment.