tldraw/.github/workflows/publish-new.yml
Mitja Bezenšek 0f3586e2b8
Fix uploading static assets to r2 (#3941)
We have to make sure that env variables are present.

Might be better to use `makeEnv` inside these workflows instead of just
inside `upload-static-assets`? Feels repetitive though.

### Change Type

<!--  Please select a 'Scope' label ️ -->

- [ ] `sdk` — Changes the tldraw SDK
- [ ] `dotcom` — Changes the tldraw.com web app
- [ ] `docs` — Changes to the documentation, examples, or templates.
- [ ] `vs code` — Changes to the vscode plugin
- [x] `internal` — Does not affect user-facing stuff

<!--  Please select a 'Type' label ️ -->

- [x] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [ ] `improvement` — Improving existing features
- [ ] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [ ] `tests` — Changes to any test code
- [ ] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know


### Release Notes

- Fix an issue with uploading the static assets.
2024-06-14 12:52:20 +00:00

81 lines
2.8 KiB
YAML

name: Publish new packages from main
# This bumps the version, updates the changelogs, publishes a GitHub release, and publishes the packages to npm.
# Prevent more than one non-canary npm publishing job from running at the same time
concurrency:
group: npm-publish
# Package publishing is manually triggered on github actions dashboard
on:
workflow_dispatch:
inputs:
bump_type:
type: choice
description: Version Bump Type
required: true
default: 'minor'
options:
- minor
- major
- override
version_override:
type: string
description: Version Override
required: false
jobs:
deploy:
name: 'Publish new version of public packages'
environment: npm deploy
timeout-minutes: 60
runs-on: ubuntu-latest-16-cores-open
steps:
- name: Check inputs
run: |
if [[ "${{ inputs.bump_type }}" != "override" ]] && ! [[ -z "${{ inputs.version_override }}" ]]; then
echo "ERROR You must set the Bump Type to 'override' if you supply a custom version number override."
exit 1
fi
- name: Generate GH token
id: generate_token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
with:
app_id: ${{ secrets.HUPPY_APP_ID }}
private_key: ${{ secrets.HUPPY_APP_PRIVATE_KEY }}
- name: Check out code
uses: actions/checkout@v3
with:
token: ${{ steps.generate_token.outputs.token }}
- name: Prepare repository
# Fetch full git history and tags for auto
run: git fetch --unshallow --tags
- name: Run our setup
uses: ./.github/actions/setup
- name: Publish
run: |
git config --global user.name 'huppy-bot[bot]'
git config --global user.email '128400622+huppy-bot[bot]@users.noreply.github.com'
if [[ "${{ inputs.bump_type }}" == "override" ]]; then
yarn tsx ./scripts/publish-new.ts --bump ${{ inputs.version_override }}
else
yarn tsx ./scripts/publish-new.ts --bump ${{ inputs.bump_type }}
fi
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
HUPPY_TOKEN: ${{ secrets.HUPPY_TOKEN }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_ACCESS_KEY_SECRET: ${{ secrets.R2_ACCESS_KEY_SECRET }}
publish_templates:
name: Publishes code templates to separate repositories
uses: tldraw/tldraw/.github/workflows/publish-templates.yml@main
secrets:
VITE_TEMPLATE_REPO_SSH_DEPLOY_KEY: ${{ secrets.VITE_TEMPLATE_REPO_SSH_DEPLOY_KEY }}
NEXTJS_TEMPLATE_REPO_SSH_DEPLOY_KEY: ${{ secrets.NEXTJS_TEMPLATE_REPO_SSH_DEPLOY_KEY }}
needs: [deploy]