Skip to content

Commit

Permalink
fix: promote beta to stable on merge to main (#1995)
Browse files Browse the repository at this point in the history
* chore: promote beta to stable on merge to main

* chore: schedule prod deploy PR every Tue
  • Loading branch information
sweatybridge authored Feb 27, 2024
1 parent c4751ee commit 7c08f7f
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 13 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Prod Deploy

on:
# Run this action every Tuesday at 02:00 UTC (Singapore 10AM)
schedule:
- cron: "0 2 * * 2"
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- run: gh pr create -B main -H develop --title 'Prod deploy' --fill
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 0 additions & 2 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ jobs:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BREWTAP_TOKEN: ${{ secrets.GH_PAT }}
SCOOP_TOKEN: ${{ secrets.GH_PAT }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}

- run: gh release edit v${{ needs.release.outputs.new-release-version }} --draft=false --prerelease
Expand Down
40 changes: 32 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,74 @@
name: Release

on:
release:
types:
- released
push:
branches:
- main

jobs:
settings:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
release_tag: ${{ steps.prerelease.outputs.tagName }}
steps:
- uses: actions/checkout@v4
- id: prerelease
run: |
gh release list --limit 1 --json tagName --jq \
'.[]|to_entries|map("\(.key)=\(.value|tostring)")|.[]' >> $GITHUB_OUTPUT
- run: gh release edit ${{ steps.prerelease.outputs.tagName }} --latest

commit:
name: Publish Brew and Scoop
needs:
- settings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- run: go run tools/publish/main.go "${GITHUB_REF_NAME#v}"
- run: go run tools/publish/main.go ${{ needs.settings.outputs.release_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

publish:
name: Publish NPM
needs:
- settings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- run: npm dist-tag add "supabase@${GITHUB_REF_NAME#v}" latest
- run: npm dist-tag add "supabase@${RELEASE_TAG#v}" latest
env:
RELEASE_TAG: ${{ needs.settings.outputs.release_tag }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

compose:
name: Publish self-hosted
name: Bump self-hosted versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- run: go run tools/selfhost/main.go "cli/$GITHUB_REF_NAME"
- run: go run tools/selfhost/main.go
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

changelog:
name: Publish changelog
needs:
- commit
- publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -61,13 +83,15 @@ jobs:

docs:
name: Publish reference docs
needs:
- settings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- run: go run docs/main.go "${GITHUB_REF_NAME#v}" | go run tools/bumpdoc/main.go apps/docs/spec/cli_v1_commands.yaml
- run: go run docs/main.go ${{ needs.settings.outputs.release_tag }} | go run tools/bumpdoc/main.go apps/docs/spec/cli_v1_commands.yaml
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
9 changes: 6 additions & 3 deletions docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"bytes"
"embed"
"flag"
"fmt"
"log"
"os"
Expand All @@ -27,9 +28,11 @@ var (
)

func main() {
semver := "latest"
if len(os.Args) > 1 {
semver = os.Args[1]
semver := flag.Arg(0)
if len(semver) == 0 {
semver = "latest"
} else if semver[0] == 'v' {
semver = semver[1:]
}

if err := generate(semver); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions tools/publish/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ func main() {
semver := flag.Arg(0)
if len(semver) == 0 {
log.Fatalln("Missing required arg: version")
} else if semver[0] == 'v' {
semver = semver[1:]
}

ctx, _ := signal.NotifyContext(context.Background(), os.Interrupt)
Expand Down

0 comments on commit 7c08f7f

Please sign in to comment.