Collect and Store Artifacts #21
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: Collect and Store Artifacts | |
on: | |
schedule: | |
- cron: '0 0 * * 0' # run every Sunday at 00:00 | |
workflow_dispatch: # allow manual triggering | |
jobs: | |
collect_and_store_artifacts: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Source Code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' # Adjust as needed | |
- name: Build Projects and Collect Artifacts | |
run: | | |
# Set required variables | |
org_name="wilfordwoodruff" # replace with your organization name | |
token=${{ secrets.TYLER_PAT }} | |
base_url=https://api.github.com | |
# Get the list of repositories in the organization | |
repo_list=$(curl -H "Authorization: token $token" $base_url/orgs/$org_name/repos) | |
repo_names=$(echo "$repo_list" | jq -r '.[].name') | |
# Iterate through each repository | |
for repo in $repo_names; do | |
# Clone the repo | |
git clone https://github.com/$org_name/$repo.git | |
# Go to the repo directory | |
cd $repo | |
# Install Python dependencies and build project | |
# This is just an example, you should adjust this to match your build process | |
python3 -m venv venv | |
source venv/bin/activate | |
pip install -r requirements.txt | |
# python your_build_script.py | |
# Collect artifacts | |
# This step is highly dependent on your project structure and the location of your build artifacts | |
# cp ./path/to/artifacts ../artifacts/$repo | |
# Go back to the root directory | |
cd .. | |
# Delete the cloned repo | |
rm -rf $repo | |
done | |
- name: Branch Creation and Committing Changes | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git checkout -b dev | |
git add -A | |
if [[ `git status --porcelain` ]]; then | |
git commit -m "Add artifacts from repos" | |
git push origin dev | |
else | |
echo "No changes to commit" | |
fi |