-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: publish binaries * add windows --------- Co-authored-by: Luis Moreno <[email protected]>
- Loading branch information
Showing
1 changed file
with
82 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,82 @@ | ||
name: "Publish binaries" | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
bump_dev_release: | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'bytecodealliance/cargo-component' | ||
name: Create dev release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Login GH CLI | ||
run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }}) | ||
- name: Delete old dev release | ||
run: gh release delete -R bytecodealliance/cargo-component dev -y || true | ||
- name: Create new latest release | ||
run: gh release create -R bytecodealliance/cargo-component dev --notes "Published artifacts from the latest build" | ||
|
||
publish_dev_release: | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'bytecodealliance/cargo-component' | ||
name: Publish to dev release | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- rust-target: x86_64-unknown-linux-gnu | ||
os: ubuntu-latest | ||
- rust-target: x86_64-apple-darwin | ||
os: macos-latest | ||
- rust-target: x86_64-pc-windows-gnu | ||
os: windows-latest | ||
|
||
needs: | ||
- bump_dev_release | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust | ||
run: rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.rust-target }} | ||
- run: cargo build --release --target ${{ matrix.rust-target }} | ||
- run: mv ./target/${{ matrix.rust-target }}/release/cargo-component.exe ./target/${{ matrix.rust-target }}/release/cargo-component-${{ matrix.rust-target }} | ||
if: matrix.os == 'windows-latest' | ||
- run: mv ./target/${{ matrix.rust-target }}/release/cargo-component ./target/${{ matrix.rust-target }}/release/cargo-component-${{ matrix.rust-target }} | ||
if: matrix.os != 'windows-latest' | ||
- name: Login GH CLI | ||
run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }}) | ||
- run: gh release upload -R bytecodealliance/cargo-component --clobber dev target/${{ matrix.rust-target }}/release/cargo-component-${{ matrix.rust-target }} | ||
|
||
publish_tagged_release: | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'bytecodealliance/cargo-component' | ||
name: Publish to tagged release | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- rust-target: x86_64-unknown-linux-gnu | ||
os: ubuntu-latest | ||
- rust-target: x86_64-apple-darwin | ||
os: macos-latest | ||
- rust-target: x86_64-pc-windows-gnu | ||
os: windows-latest | ||
|
||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust | ||
run: rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.rust-target }} | ||
- run: cargo build --release --target ${{ matrix.rust-target }} | ||
- run: mv ./target/${{ matrix.rust-target }}/release/cargo-component.exe ./target/${{ matrix.rust-target }}/release/cargo-component-${{ matrix.rust-target }} | ||
if: matrix.os == 'windows-latest' | ||
- run: mv ./target/${{ matrix.rust-target }}/release/cargo-component ./target/${{ matrix.rust-target }}/release/cargo-component-${{ matrix.rust-target }} | ||
if: matrix.os != 'windows-latest' | ||
- name: Login GH CLI | ||
run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }}) | ||
- run: gh release upload -R bytecodealliance/cargo-component --clobber ${{ github.ref_name }} target/${{ matrix.rust-target }}/release/cargo-component-${{ matrix.rust-target }} |