Skip to content
Merged
Changes from 23 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fe19950
feat(tutorial): GitHub action to sync object storage
LLejoly Mar 10, 2025
e2f7535
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
4a5b98c
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
506428d
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
f0c2381
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
21e470a
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
835cd1c
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
4dbf179
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
cfda2c8
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
111f23d
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
599f6d2
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
44344c7
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
2ad0c1a
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
690f418
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
a1f7269
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
6ce2584
Merge branch 'scaleway:main' into ext-add-tutorial-cicd-github-action…
LLejoly Mar 21, 2025
43a85ef
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
0690faf
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
ccc9783
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
c9f78fd
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
9321334
Update tutorials/cicd-github-action-object-storage-sync/index.mdx
LLejoly Mar 21, 2025
b76035f
Update index.mdx
LLejoly Mar 21, 2025
5db5ebf
Merge branch 'scaleway:main' into ext-add-tutorial-cicd-github-action…
LLejoly Mar 21, 2025
9b910ce
Update index.mdx
LLejoly Mar 28, 2025
d85ca40
Update index.mdx
LLejoly Mar 28, 2025
87913f1
Apply suggestions from code review
SamyOubouaziz Mar 31, 2025
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
124 changes: 124 additions & 0 deletions tutorials/cicd-github-action-object-storage-sync/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
---
meta:
title: Synchronizing your website with Object Storage using GitHub Actions
description: Learn how to automatically sync files from a GitHub repository with Scaleway Object Storage using GitHub Actions to deploy your website
content:
h1: Synchronizing your website with Object Storage using GitHub Actions
paragraph: Learn how to automatically sync files from a GitHub repository with Scaleway Object Storage using GitHub Actions to deploy your website
tags: ci cd github actions object storage s3cmd sync workflow
categories:
- object-storage
dates:
validation: 2025-03-10
posted: 2025-03-10
---

Deploying your content to Scaleway Object Storage Using GitHub Actions

This tutorial will guide you through setting up a GitHub Action to deploy your Astro site to Scaleway Object Storage. We will use a GitHub Actions workflow to automate the deployment process whenever changes are pushed to the `main` branch.

<Macro id="requirements" />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- A [GitHub](https://github.com/) repository with your [Astro](https://astro.build/) project.
- A Scaleway Object Storage bucket with the [bucket website](/object-storage/how-to/use-bucket-website/) feature enabled
- Retrieved your Scaleway credentials ([API key](/iam/how-to/create-api-keys/), Project ID, Organization ID).

Create the GitHub Actions Workflow

1. In your GitHub repository, navigate to the `.github/workflows` directory. If it does not exist, create it at the root of your repository.
2. Create a new file named `deploy.yml` in the `.github/workflows` directory.

Define the workflow

Copy and paste the following code into the `deploy.yml` file. This workflow will run on every push to the `main` branch, build your Astro website, and upload the built files to Scaleway Object Storage.

```yaml
name: Upload to Scaleway Object Storage

on:
push:
branches:
- main # Change this to your default branch if different (e.g. "trunk", or "master")

jobs:
upload:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '23'

- name: Install dependencies
run: npm install

- name: Build the website
run: npm run build

- name: Install s3cmd
run: sudo apt-get install -y s3cmd

- name: Install the Scaleway CLI
uses: scaleway/action-scw@v0
with:
version: v2.37.0

- run: |
scw object config get type=s3cmd > /home/runner/.s3cfg
s3cmd --no-mime-magic --guess-mime-type sync ./dist/* s3://your_bucket_name/
env:
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }}
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }}
SCW_PROJECT_ID: ${{ secrets.SCW_PROJECT_ID }}
SCW_ORGANIZATION_ID: ${{ secrets.SCW_ORGANIZATION_ID }}
```

Configure repository secrets

In your GitHub repository, go to Settings > Secrets and variables > Actions.
Add the following secrets with your Scaleway credentials:

- SCW_ACCESS_KEY
- SCW_SECRET_KEY
- SCW_PROJECT_ID
- SCW_ORGANIZATION_ID

Commit and push your changes

Run the commands below to commit and push the `deploy.yml` file to your repository. If you are working directly on your main branch, this will trigger the GitHub Action to run on the main branch.

```bash
git add .github/workflows/deploy.yml
git commit -m "Add GitHub Action for deploying to Scaleway Object Storage"
git push origin main
```

You can now access your website by clicking the **Website URL** from the **Settings** tab of your bucket in the [Scaleway console](https://console.scaleway.com/object-storage/buckets).

## Alternative build processes

If your project uses a different build process, replace the `Install dependencies`and `Build the website` steps with the appropriate commands for your environment. The code below shows an example of an alternative build process using [Astral](https://astral.sh/).


```yaml
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install the project
run: uv sync --all-extras --dev
- name: Build the project
run: uv build
```

## Troubleshooting and additional resources

- If you encounter issues while using your API key with Scaleway Object Storage, refer to the [dedicated troubleshooting](/object-storage/troubleshooting/api-key-does-not-work/).

- Refer to the [official GitHub Actions documentation](https://docs.github.com/en/actions/writing-workflows/quickstart) for more information on how to create and run workflows.

- Learn how to better secure your deployment by properly [setting up IAM and Object Storage](/object-storage/api-cli/combining-iam-and-object-storage/)