Update deps #11
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
name: release | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- Cargo.toml | |
jobs: | |
check-version: | |
runs-on: ubuntu-latest | |
outputs: | |
is_new_version: ${{steps.check_version.outputs.previous-version != steps.check_version.outputs.current-version }} | |
current_version: ${{steps.check_version.outputs.current-version}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Check verson | |
uses: salsify/action-detect-and-tag-new-version@v2 | |
id: check_version | |
with: | |
create-tag: false | |
version-command: cargo read-manifest | jq -r .version | |
build-windows: | |
needs: check-version | |
if: ${{needs.check-version.outputs.is_new_version}} == true | |
runs-on: windows-latest | |
env: | |
ARTIFACT_NAME: h8pks-x86_64-pc-windows-msvc-${{needs.check-version.outputs.current_version}}.zip | |
outputs: | |
artifact_name: ${{env.ARTIFACT_NAME}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set rust-toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-pc-windows-msvc | |
- name: Build | |
run: cargo build --release --target=x86_64-pc-windows-msvc | |
- name: Package | |
run: | | |
powershell Compress-Archive -Path target/x86_64-pc-windows-msvc/release/h8pks.exe -DestinationPath ${{env.ARTIFACT_NAME}} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{env.ARTIFACT_NAME}} | |
path: ./${{env.ARTIFACT_NAME}} | |
if-no-files-found: error | |
build-linux-gnu: | |
needs: check-version | |
if: ${{needs.check-version.outputs.is_new_version}} == true | |
runs-on: ubuntu-latest | |
env: | |
ARTIFACT_NAME: h8pks-x86_64-unknown-linux-gnu-${{needs.check-version.outputs.current_version}}.zip | |
outputs: | |
artifact_name: ${{env.ARTIFACT_NAME}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set rust-toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-unknown-linux-gnu | |
- name: Build | |
run: cargo build --release --target=x86_64-unknown-linux-gnu | |
- name: Package | |
run: | | |
zip --junk-paths ${{env.ARTIFACT_NAME}} target/x86_64-unknown-linux-gnu/release/h8pks | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{env.ARTIFACT_NAME}} | |
path: ./${{env.ARTIFACT_NAME}} | |
if-no-files-found: error | |
release: | |
runs-on: ubuntu-22.04 | |
needs: [check-version, build-windows, build-linux-gnu] | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./artifacts | |
- name: Create tag | |
id: create_tag | |
uses: mathieudutour/[email protected] | |
with: | |
custom_tag: ${{needs.check-version.outputs.current_version}} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create a GitHub release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.create_tag.outputs.new_tag }} | |
name: Release ${{ steps.create_tag.outputs.new_tag }} | |
body: ${{ steps.create_tag.outputs.changelog }} | |
artifacts: | |
"./artifacts/${{needs.build-windows.outputs.artifact_name}}/${{needs.build-windows.outputs.artifact_name}}, | |
./artifacts/${{needs.build-linux-gnu.outputs.artifact_name}}/${{needs.build-linux-gnu.outputs.artifact_name}}" | |
makeLatest: "latest" |