Upload build artifact and release #249
Workflow file for this run
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: Rust build, test and clippy | |
on: | |
push: | |
pull_request: | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.5.2 | |
- name: Cache rust target files | |
uses: actions/cache@v3.3.1 | |
with: | |
path: target | |
key: ${{ runner.os }}-rust-target | |
- name: Check | |
run: cargo check --verbose --all-targets --locked | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Clippy | |
run: cargo clippy --verbose --no-deps --all-targets --locked | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.5.2 | |
- name: Cache rust target files | |
uses: actions/cache@v3.3.1 | |
with: | |
path: target | |
key: ${{ runner.os }}-rust-target | |
- name: Install sass | |
run: sudo npm install -g sass | |
- name: Build | |
run: cargo build --bin=server --release --locked --verbose | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-output | |
path: | | |
target/production/server | |
public/ | |
if-no-files-found: error | |
release: | |
runs-on: ubuntu-latest | |
needs: [validate, build] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-output | |
- name: GH Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
target/production/server | |
public/ | |
generate_release_notes: true |