Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/cow-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: 'Deploy: files.cow.fi'

on:
push:
branches:
- main
paths:
- 'static-files/public/**'
pull_request:
paths:
- 'static-files/public/**'
workflow_dispatch: # Manual trigger

# Required for authenticating with AWS IAM
permissions:
id-token: write
contents: read

env:
NODE_VERSION: lts/gallium

jobs:
deploy:
name: Deploy to files.cow.fi
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::693696263829:role/cow-files-github-action-role
role-session-name: githubactionsession
aws-region: eu-central-1

- name: Upload to S3
run: |
aws s3 sync static-files/public/ s3://files.cow.fi/cow-files/ \
--delete \
--exclude ".DS_Store" \
--exclude "*.tmp" \
--exclude "*.temp"

- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/cow-files/*"
25 changes: 25 additions & 0 deletions static-files/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# CoW Files

This application serves as a static file hosting repository for files that are automatically uploaded to files.cow.fi via GitHub workflows.

## Usage

1. Place any files that need to be hosted on `files.cow.fi` in the `public/` directory
2. Files will be automatically uploaded to `files.cow.fi` through GitHub workflows
3. The directory structure in `public/` will be preserved in the final URL path

For example:

- A file `public/example.json` will be available at `https://files.cow.fi/cow-files/example.json`
- A file `public/docs/guide.pdf` will be available at `https://files.cow.fi/cow-files/docs/guide.pdf`

## File Organization Guidelines

- Keep files organized in meaningful subdirectories
- Use lowercase names for files and directories
- Use hyphens (-) instead of spaces in filenames
- Include version numbers in filenames when applicable

## Automatic Deployment

Files are automatically deployed to `files.cow.fi` through GitHub workflows. The workflow configuration can be found in the repository's `.github/workflows` directory.
1 change: 1 addition & 0 deletions static-files/public/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello world 2
Loading