Allow to powerwash from github UI #43
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
#file: noinspection SpellCheckingInspection | |
name: CI | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
power_wash: | |
type: boolean | |
description: Fetch versions that are already in the cache | |
required: true | |
default: false | |
jobs: | |
changes: | |
name: Check file changes | |
runs-on: ubuntu-latest | |
outputs: | |
cargo: ${{ steps.changes.outputs.cargo }} | |
silo: ${{ steps.changes.outputs.silo }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
cargo: ['Cargo.*', 'Deny.toml', '**/*/Cargo.*'] | |
silo: ['Cargo.*', 'silo/**/*', 'modules/data/**/*', 'modules/net/**/*', 'modules/utils/**/*'] | |
check: | |
name: Check code | |
needs: [ changes ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run cargo-deny | |
if: needs.changes.outputs.cargo == 'true' | |
run: | | |
cargo install cargo-deny | |
cargo-deny check -c Deny.toml bans licenses sources | |
- uses: olix0r/cargo-action-fmt/setup@v2 | |
- run: cargo check --locked --message-format=json | cargo-action-fmt | |
- run: cargo test --locked --no-run --message-format=json | cargo-action-fmt | |
- run: cargo test --locked | |
metadata: | |
name: Deploy metadata site | |
needs: [ check, changes ] | |
if: (github.event_name == 'push' && needs.changes.outputs.silo == 'true') || (github.event_name == 'workflow_dispatch') | |
runs-on: ubuntu-latest | |
concurrency: Metadata Site | |
environment: | |
name: Metadata Site | |
url: ${{ steps.deployment.outputs.url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- run: git clone --depth 1 https://andre4ik3:${{ secrets.META_TOKEN }}@github.com/andre4ik3/Launcher-Meta.git _site | |
- name: Run silo | |
run: | | |
if [[ "${{ inputs.power_wash }}" == "true" ]]; then | |
cargo run --locked --bin silo -- --power-wash | |
else | |
cargo run --locked --bin silo | |
fi | |
- uses: EndBug/add-and-commit@v9 | |
with: { cwd: "./_site", default_author: github_actions } | |
- id: deployment | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: launchermeta | |
directory: _site |