Fetch Contribution Data 🛠️ #7
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: Fetch Contribution Data 🛠️ | |
on: | |
# push: | |
# branches: [ main ] | |
# pull_request: | |
# branches: [ main ] | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * 1" # Runs at 00:00 UTC on Monday | |
jobs: | |
container-job: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: pyramation/postgis | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "21" | |
- name: Install dependencies | |
run: yarn install | |
- name: Wait for PostgreSQL to be ready | |
run: | | |
echo "Waiting for PostgreSQL to be ready..." | |
for i in {1..30}; do | |
pg_isready -h localhost -p 5432 -U postgres && break | |
sleep 1 | |
done | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_FE_DEPLOYER_ACCESS }} | |
aws-secret-access-key: ${{ secrets.AWS_FE_DEPLOYER_SECRET }} | |
aws-region: "us-east-1" | |
- name: Install AWS CLI v2 | |
run: | | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o /tmp/awscliv2.zip | |
unzip -q /tmp/awscliv2.zip -d /tmp | |
rm /tmp/awscliv2.zip | |
sudo /tmp/aws/install --update | |
rm -rf /tmp/aws/ | |
- name: Run it 🚀 | |
run: | | |
yarn build | |
cd ./packages/stats-db | |
./scripts/schema.sh | |
yarn npm:fetch:packages | |
yarn npm:fetch:downloads | |
yarn npm:report | |
yarn npm:badges | |
yarn npm:readme | |
env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DATABASE_URL: postgres://postgres:password@localhost:5432/example_db | |
# AWS S3 Configuration | |
AWS_REGION: us-east-1 | |
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} | |
# AWS Credentials | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_FE_DEPLOYER_ACCESS }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_FE_DEPLOYER_SECRET }} | |
- name: Upload artifacts 📦 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lib-count-badges | |
path: | | |
badges/lib-count/total_downloads.json | |
badges/lib-count/monthly_downloads.json | |
badges/lib-count/utils_category.json | |
badges/lib-count/launchql_category.json | |
badges/lib-count/hyperweb_category.json |