mirror of
https://github.com/Skallwar/suckit.git
synced 2026-09-10 07:16:19 -04:00
ci: Add release build (#106)
* ci: Build target aware * ci: Add release.yml
This commit is contained in:
parent
09af371589
commit
1ddbe1702e
32
.github/workflows/build_and_test.yml
vendored
32
.github/workflows/build_and_test.yml
vendored
|
|
@ -22,22 +22,46 @@ jobs:
|
|||
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
target: [x86_64-unknown-linux-gnu]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Rustup setup
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
default: true
|
||||
target: ${{ matrix.target }}
|
||||
|
||||
- name: Unit tests
|
||||
run: |
|
||||
cargo test
|
||||
cargo test --target ${{ matrix.target }}
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, tests]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
target: [x86_64-unknown-linux-gnu]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Rustup setup
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
default: true
|
||||
target: ${{ matrix.target }}
|
||||
|
||||
- name: Check
|
||||
run: |
|
||||
cargo check
|
||||
cargo check --target ${{ matrix.target }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cargo build
|
||||
cargo build --target ${{ matrix.target }}
|
||||
|
|
|
|||
46
.github/workflows/release.yml
vendored
Normal file
46
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
name: Release upload artifact
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published, edited]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
target: [x86_64-unknown-linux-gnu]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Rustup setup
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
default: true
|
||||
target: ${{ matrix.target }}
|
||||
|
||||
- name: Build release
|
||||
run: |
|
||||
cargo build --release --target ${{ matrix.target }}
|
||||
|
||||
- name: Retrive tag
|
||||
id: retrive_tag
|
||||
run: |
|
||||
echo "##[set-output name=tag;]$(echo ${GITHUB_REF} | cut -d / -f3)"
|
||||
|
||||
- name: Find upload URL
|
||||
id: upload_url
|
||||
run: |
|
||||
echo "##[set-output name=url;] $(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/skallwar/suckit/releases/tags/${{ steps.retrive_tag.outputs.tag }} | jq .upload_url -r)"
|
||||
|
||||
- name: Upload Release Asset
|
||||
id: upload-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.upload_url.outputs.url}}
|
||||
asset_path: ./target/${{ matrix.target }}/release/suckit
|
||||
asset_name: suckit-${{ steps.retrive_tag.outputs.tag }}-${{ matrix.target }}
|
||||
asset_content_type: application/x-elf
|
||||
Loading…
Reference in a new issue