mirror of
https://github.com/transloadit/uppy.git
synced 2026-01-23 02:25:07 +00:00
https://github.com/transloadit/api2/blob/main/docs/releases-bucket.md
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Switch CDN publishing from Edgly to S3-compatible Cloudflare R2/Bunny
with new env vars and updated upload script/workflows.
>
> - **CI/CD Workflows**
> - Replace `EDGLY_*` creds with
`AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` and set `AWS_REGION`,
`S3_BUCKET`, `S3_ENDPOINT` in `manual-cdn.yml` and `release.yml`.
> - Use updated env when running `upload-to-cdn.js` for both normal and
`--force` uploads.
> - **Upload Script (`packages/uppy/upload-to-cdn.js`)**
> - Switch to S3-compatible client targeting Cloudflare R2 (`endpoint`,
`forcePathStyle`) and read bucket/region from env.
> - Validate required env vars (`AWS_ACCESS_KEY_ID`,
`AWS_SECRET_ACCESS_KEY`, `S3_ENDPOINT`, `S3_BUCKET`).
> - Derive version from local `package.json` when uploading local
builds; keep npm tarball path for remote versions.
> - Update comments/paths; remove all `EDGLY_*` references.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
502c3fec3d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
123 lines
4.1 KiB
YAML
123 lines
4.1 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
jobs:
|
|
release:
|
|
name: Release
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
AWS_REGION: auto
|
|
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
|
|
outputs:
|
|
companionWasReleased: ${{ steps.checkIfCompanionWasReleased.outputs.version }}
|
|
published: ${{ steps.changesets.outputs.published }}
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: lts/*
|
|
|
|
# Allow yarn to make changes during release
|
|
- run: corepack yarn config set enableHardenedMode false
|
|
- run: corepack yarn --mode=update-lockfile
|
|
|
|
- name: Install dependencies
|
|
run: corepack yarn install --immutable
|
|
|
|
- name: Build
|
|
run: corepack yarn build
|
|
|
|
- name: '@uppy/angular prepublish'
|
|
run: corepack yarn workspace @uppy/angular prepublishOnly
|
|
|
|
- run: |
|
|
echo '' >> .yarnrc.yml
|
|
echo 'npmAuthToken: "${NPM_TOKEN}"' >> .yarnrc.yml
|
|
|
|
- name: Create Release Pull Request or Publish
|
|
id: changesets
|
|
uses: changesets/action@v1
|
|
with:
|
|
version: corepack yarn run version
|
|
publish: corepack yarn run release
|
|
commit: '[ci] release'
|
|
title: '[ci] release'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Remove npmAuthToken from yarnrc
|
|
run: |
|
|
sed -i '/npmAuthToken:/d' .yarnrc.yml
|
|
|
|
- name: Check if Companion was released
|
|
id: checkIfCompanionWasReleased
|
|
if: steps.changesets.outputs.published == 'true'
|
|
run: |
|
|
git diff --exit-code --quiet HEAD^ -- packages/@uppy/companion/package.json || echo "version=$(jq -r .version < packages/@uppy/companion/package.json)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Upload `uppy` to CDN
|
|
if: steps.changesets.outputs.published == 'true'
|
|
run: node packages/uppy/upload-to-cdn.js uppy
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
- name: Upload `@uppy/locales` to CDN if it was released
|
|
if: steps.changesets.outputs.published == 'true'
|
|
run: node packages/uppy/upload-to-cdn.js @uppy/locales
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
|
|
# See also companion-deploy.yml
|
|
docker:
|
|
name: DockerHub
|
|
needs: release
|
|
if: ${{ needs.release.outputs.published == 'true' && needs.release.outputs.companionWasReleased }}
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
DOCKER_BUILDKIT: 0
|
|
COMPOSE_DOCKER_CLI_BUILD: 0
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v6
|
|
- name: Docker meta
|
|
id: docker_meta
|
|
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
|
|
with:
|
|
images: transloadit/companion
|
|
tags: |
|
|
type=edge
|
|
type=semver,pattern={{version}},value=${{ needs.release.outputs.companionWasReleased }}
|
|
# set latest tag for default branch
|
|
type=raw,value=latest,enable=true
|
|
- uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
|
|
- uses: docker/setup-buildx-action@v3
|
|
- name: Log in to DockerHub
|
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
|
with:
|
|
username: ${{secrets.DOCKER_USERNAME}}
|
|
password: ${{secrets.DOCKER_PASSWORD}}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
|
|
with:
|
|
push: true
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
file: Dockerfile
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|