-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #231 from hougesen/ci/release-workflow
ci: release workflow
- Loading branch information
Showing
1 changed file
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |