Files
matugen/.gitea/workflows/vendor-dependencies.yml
Claudio Yanes f31b5630bc
Some checks failed
Generate Vendor Dependencies / vendor-dependencies (push) Failing after 49s
Use zypper to install cargo-vendor [force-vendor]
2025-11-14 05:05:19 +00:00

89 lines
3.2 KiB
YAML

name: Generate Vendor Dependencies
on:
push:
branches:
- master
workflow_dispatch:
jobs:
vendor-dependencies:
runs-on: tumbleweed
if: "!contains(github.event.head_commit.message, '[skip-vendor]') && github.actor != 'gitea-actions[bot]'"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITEA_TOKEN || github.token }}
submodules: recursive
fetch-depth: 2
- name: Check for submodule changes
id: should-update
run: |
# Check if matugen submodule has changed
if git diff HEAD~1 HEAD --name-only | grep -q "^matugen$" || [[ "${{ github.event.head_commit.message }}" == *"[force-vendor]"* ]]; then
echo "update_needed=true" >> $GITHUB_OUTPUT
echo "Submodule matugen has been updated"
else
echo "update_needed=false" >> $GITHUB_OUTPUT
echo "No submodule changes detected"
fi
- name: Install cargo-vendor
run: zypper --non-interactive install cargo-vendor-filterer cargo
- name: Generate vendor directory
if: steps.should-update.outputs.update_needed == 'true'
run: |
cd matugen
# Clean any existing vendor directory
rm -rf vendor/
# Generate fresh vendor directory
cargo vendor vendor --versioned-dirs > .cargo/config.toml
- name: Create vendor archive
if: steps.should-update.outputs.update_needed == 'true'
run: |
cd matugen
# Remove old archive if it exists
rm -f vendor.tar.zst
# Create compressed archive
tar --zstd -cf vendor.tar.zst vendor/ .cargo/config.toml
echo "Created vendor archive: $(du -h vendor.tar.zst)"
- name: Configure git
if: steps.should-update.outputs.update_needed == 'true'
run: |
git config --local user.email "action@gitea.local"
git config --local user.name "Gitea Actions Bot"
- name: Commit vendor archive
if: steps.should-update.outputs.update_needed == 'true'
run: |
mv matugen/vendor.tar.zst .cargo .
# Add the vendor archive to git
git add vendor.tar.zst .cargo/config.toml
# Create commit message with details
commit_msg="chore: update vendor dependencies archive [skip-vendor]
- Generated from submodule commit: $(git rev-parse HEAD)
This commit was auto-generated by Gitea Actions."
git commit -m "$commit_msg"
- name: Push changes
if: steps.should-update.outputs.update_needed == 'true'
run: |
# Push to the current branch
git push origin HEAD:${{ github.ref_name }}