S3 Uploader for GitHub Actions

Learn how to configure S3 Uploader for GitHub Actions for use with Filebase.

What is S3 Uploader for GitHub Actions?

S3 Uploader for GitHub Actions is an open-source GitHub Action that enables developers to configure automatic backups for their GitHub repositories to an S3-compatible service like Filebase whenever their GitHub repository’s main branch is pushed or updated by a pull request.

This GitHub Action source code can be found here.

Read below to learn how to configure S3 Uploader for GitHub Actions with Filebase.

Prerequisites:

1. Create a GitHub repository, or navigate to an existing repository. Select the 'Settings' tab.

2. From the left side bar menu, select 'Secrets', then 'Actions', then click the button 'New Repository Secret':

3. Create a new secret called FILEBASE_ACCESS_KEY. Enter your Filebase Access Key for the value of this secret.

4. Repeat this step to create a second secret called FILEBASE_SECRET_KEY. Enter your Filebase Secret Key for the value of this second secret.

5. Select ‘Actions’ from the top menu bar.

6. In the GitHub Actions menu, select ‘Set Up a Workflow Yourself”.

7. Enter the following code into the new file, by default called ‘main.yml’:

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  upload-s3-parts:
    runs-on: ubuntu-latest
    steps:
      - name: checkout
        uses: actions/checkout@v2

      - name: install node 16
        uses: actions/setup-node@v2
        with:
          node-version: 16.x

      - name: S3 Uploader for GitHub Actions
        uses: Noelware/s3-action@1.3.1
        with:
          directories: '*'
          endpoint: https://s3.filebase.com
          bucket: github-test-bucket
          access-key: ${{ secrets.FILEBASE_ACCESS_KEY }}
          secret-key: ${{ secrets.FILEBASE_SECRET_KEY }}

Replace the following values to match your configuration:

  • Directories: The directories in your GitHub repository you would like to upload to Filebase.

  • Bucket: Your Filebase Bucket Name

In this configuration, all files in our repository are being backed up, and this workflow is configured to be run automatically whenever the main branch is pushed to or merged with a pull request.

8. Then, select ‘Start Commit’ on the right side of the screen. Commit your file.

9. You will then see your main.yml file listed in your repository.

Select the ‘Actions’ tab from the menu bar again to check the status of the GitHub action, which was run automatically when it was committed. From here, it will be run automatically whenever the main branch of your repository is pushed to or merged with a pull request.

10. Your GitHub action will show a green check mark, meaning that it was able to run successfully.

11. You can verify that your GitHub repository files were uploaded to your Filebase bucket by checking the contents of your Filebase bucket on the web console.

If you have any questions, please join our Discord server, or send us an email at hello@filebase.com

Last updated