Update Crate #281
This file contains hidden or 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: Update Crate | |
| on: | |
| schedule: | |
| - cron: "0 0 * * 0" # every Sunday at midnight | |
| workflow_dispatch: {} | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| clean: false | |
| fetch-depth: 0 # needed to push tags later | |
| - uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install cargo-release | |
| run: | | |
| if ! command -v cargo-release &> /dev/null; then | |
| cargo install cargo-release | |
| fi | |
| - name: Install cargo-edit | |
| run: | | |
| if ! command -v cargo-set-version &> /dev/null; then | |
| cargo install cargo-edit | |
| fi | |
| - name: Build & run | |
| working-directory: ua_generator | |
| env: | |
| BUILD_ENABLED: "1" | |
| APILAYER_KEY: ${{ secrets.APILAYER_KEY }} | |
| run: | | |
| cargo build --release --features fetch | |
| - name: Bump patch for ua_generator | |
| id: bump | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| MANIFEST=$(cargo metadata --no-deps --format-version=1 \ | |
| | jq -r '.packages[] | select(.name=="ua_generator") | .manifest_path') | |
| CURR=$(awk -F' = ' '/^version =/ {gsub(/"/,"",$2); print $2; exit}' "$MANIFEST") | |
| IFS='.' read -r MAJ MIN PAT <<< "$CURR" | |
| NEXT="${MAJ}.${MIN}.$((PAT+1))" | |
| echo "next=$NEXT" >> $GITHUB_OUTPUT | |
| cargo set-version -p ua_generator "$NEXT" | |
| cargo update -w | |
| - uses: EndBug/add-and-commit@v9 | |
| with: | |
| message: "chore(agents): bump minor version and publish" | |
| committer_name: UA Generator | |
| author_name: UA Generator | |
| author_email: support@spider.cloud | |
| add: "." | |
| pull: "--rebase --autostash" | |
| - name: Release | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| APILAYER_KEY: ${{ secrets.APILAYER_KEY }} | |
| run: APILAYER_KEY=${{ secrets.APILAYER_KEY }} cargo release -p ua_generator --execute --no-confirm | |
| # - name: Push tags | |
| # run: git push --atomic origin HEAD --follow-tags |