Merge pull request #29 from readysettech/issue-28-dry-run #103
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: Build | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pre-requirements | |
run: sudo curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -q -y | |
- name: Check format | |
run: cargo fmt --check | |
- name: Run clippy | |
run: cargo clippy --workspace --all-targets --all-features -- -W clippy::disallowed_methods -D warnings | |
- name: Install cargo-generate-rpm | |
run: cargo install cargo-generate-rpm | |
- name: Install cargo-deb | |
run: cargo install cargo-deb | |
- name: Build | |
run: cargo build --release | |
- name: Generate RPM | |
run: cargo generate-rpm | |
- name: Generate DEB | |
run: cargo deb | |
- name: Save RPM / DEB name | |
run: | | |
echo "rpm_name=$(ls target/generate-rpm/)" >> "$GITHUB_ENV" | |
echo "deb_name=$(ls target/debian/ -I *-stripped)" >> "$GITHUB_ENV" | |
- name: Upload RPM | |
uses: actions/upload-artifact@v4 | |
with: | |
path: target/generate-rpm/ | |
name: ${{ env.rpm_name }} | |
- name: Upload Deb | |
uses: actions/upload-artifact@v4 | |
with: | |
path: target/debian/${{ env.deb_name }} | |
name: ${{ env.deb_name }} | |
release: | |
if: contains(github.ref, 'tags/v') | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./ | |
merge-multiple: true | |
- name: List Files | |
run: | | |
pwd | |
ls -lah ./ | |
- name: Create Release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
draft: false | |
prerelease: false | |
allowUpdates: true | |
artifactErrorsFailBuild: false | |
artifacts: | | |
*.rpm | |
*.deb |