| 1 |
name: Publish |
| 2 |
|
| 3 |
on: |
| 4 |
workflow_dispatch: |
| 5 |
push: |
| 6 |
branches: |
| 7 |
- main |
| 8 |
schedule: |
| 9 |
- cron: '0 0 * * *' |
| 10 |
|
| 11 |
env: |
| 12 |
CARGO_TERM_COLOR: always |
| 13 |
|
| 14 |
jobs: |
| 15 |
publish: |
| 16 |
|
| 17 |
runs-on: ubuntu-latest |
| 18 |
|
| 19 |
steps: |
| 20 |
- name: Checkout repository |
| 21 |
uses: actions/checkout@v4 |
| 22 |
|
| 23 |
- name: Install Rust toolchain |
| 24 |
uses: dtolnay/rust-toolchain@stable |
| 25 |
with: |
| 26 |
toolchain: stable |
| 27 |
components: rustfmt |
| 28 |
|
| 29 |
- name: Install deps |
| 30 |
run: | |
| 31 |
sudo apt update |
| 32 |
sudo apt install --yes gcc pkg-config libssl-dev |
| 33 |
|
| 34 |
- name: Install cargo play |
| 35 |
run: cargo install --locked cargo-play |
| 36 |
|
| 37 |
- name: Install cargo make |
| 38 |
run: cargo install --locked cargo-make |
| 39 |
|
| 40 |
- name: Download the list and run tests |
| 41 |
run: cargo make test |
| 42 |
|
| 43 |
- name: Publish |
| 44 |
env: |
| 45 |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }} |
| 46 |
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 47 |
shell: bash |
| 48 |
run: | |
| 49 |
if ! git diff --exit-code --quiet data/rules.txt; then |
| 50 |
cargo doc --all-features |
| 51 |
git config --local user.email "[email protected]" |
| 52 |
git config --local user.name "github-actions[bot]" |
| 53 |
git remote add upstream https://rushmorem:${{ secrets.GITHUB_TOKEN }}@github.com/addr-rs/psl.git |
| 54 |
git add data/rules.txt src/list.rs |
| 55 |
git commit -m 'update the list' |
| 56 |
cargo install --force --locked --version 0.3.108 release-plz |
| 57 |
/home/runner/.cargo/bin/release-plz update --no-changelog |
| 58 |
git add Cargo.toml |
| 59 |
git commit -m 'bump version' |
| 60 |
git push upstream main |
| 61 |
/home/runner/.cargo/bin/release-plz release |
| 62 |
fi |