-
-
Notifications
You must be signed in to change notification settings - Fork 395
Alternative preview release flow #613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: Release Branch | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| release: | ||
| timeout-minutes: 20 | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how strong guarantees do we have here when it comes to what commit gets actually built and released? a workflow could get queued and also retried later - I feel this might be risky-ish because, I'd assume, it might run against the "current" version of a branch a security researcher emailed me with a description of an atack like this:
It feels like this workflow would be prone to this attack. I know none of those preview builds can truly be trusted - but we should minimize the risks when we can. |
||
| - uses: ./.github/actions/ci-setup | ||
|
|
||
| - run: yarn changeset version --snapshot branch-${{ github.ref_name }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Build | ||
| run: yarn build | ||
|
|
||
| - name: Setup Git user | ||
| run: | | ||
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Release snapshot version | ||
| run: yarn run release:pr | ||
| env: | ||
| GITHUB_REF_NAME: ${{ github.ref_name }} | ||
|
|
||
| - name: Summarize preview release | ||
| run: | | ||
| commit_sha=$(git rev-parse HEAD) | ||
| repository_owner="${{ github.repository_owner }}" | ||
| repository_name="${{ github.event.repository.name }}" | ||
|
|
||
| { | ||
| echo "See the diff for this built version: https://github.com/changesets/action/compare/main...${repository_owner}:${repository_name}:${commit_sha}" | ||
| echo "" | ||
| echo "Use this preview build in a GitHub Actions workflow:" | ||
| echo "" | ||
| echo '```yaml' | ||
| echo " - uses: ${GITHUB_REPOSITORY}@${commit_sha}" | ||
| echo '```' | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ import path from "node:path"; | |||||
| import pkgJson from "../package.json" with { type: "json" }; | ||||||
|
|
||||||
| const tag = `v${pkgJson.version}`; | ||||||
| const releaseLine = "pr-release"; | ||||||
| const releaseLine = `built-${process.env.GITHUB_REF_NAME}`; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. git stores branches as directories, perhaps we should use a pattern like this:
Suggested change
this way they would be "grouped" |
||||||
|
|
||||||
| process.chdir(path.join(import.meta.dirname, "..")); | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, the "base" workflow is caled publish - perhaps we should rename this one to match the base one more closely?