-
Notifications
You must be signed in to change notification settings - Fork 860
Harden manual store submission workflow #990
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: master
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 |
|---|---|---|
|
|
@@ -3,123 +3,143 @@ on: | |
| workflow_dispatch: | ||
| inputs: | ||
| submit_stores: | ||
| description: "Run Chrome, Firefox, and Edge store submission preflight" | ||
| description: 'Run store submission artifact preflight without store credentials' | ||
| required: false | ||
| default: "false" | ||
| default: 'false' | ||
| type: choice | ||
| options: | ||
| - "false" | ||
| - "true" | ||
| dry_run: | ||
| description: "Validate store submission without uploading artifacts" | ||
| required: false | ||
| default: "true" | ||
| type: choice | ||
| options: | ||
| - "true" | ||
| - "false" | ||
| - 'false' | ||
| - 'true' | ||
| push: | ||
| tags: | ||
| - "v*" | ||
|
|
||
| permissions: | ||
| id-token: "write" | ||
| contents: "write" | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| - 'v*' | ||
|
|
||
| jobs: | ||
| build_and_release: | ||
| manual_preflight: | ||
| if: github.event_name == 'workflow_dispatch' | ||
| runs-on: macos-14 | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ github.event_name == 'push' && 'master' || github.ref_name }} | ||
| ref: ${{ github.ref }} | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 22 | ||
| - run: npm ci | ||
|
|
||
| - run: npm run build | ||
|
|
||
| - run: npm run release:firefox-sources | ||
|
|
||
| - name: Submit stores preflight | ||
| if: inputs.submit_stores == 'true' | ||
| run: npm run release:submit:preflight | ||
|
PeterDaveHello marked this conversation as resolved.
|
||
|
|
||
| release: | ||
| if: github.event_name == 'push' | ||
| runs-on: macos-14 | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: master | ||
| fetch-depth: 0 | ||
| persist-credentials: true | ||
|
PeterDaveHello marked this conversation as resolved.
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
|
PeterDaveHello marked this conversation as resolved.
|
||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 22 | ||
|
|
||
| - name: Resolve release version | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "push" ]; then | ||
| echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV | ||
| else | ||
| version="$(node -p "require('./src/manifest.json').version")" | ||
| echo "VERSION=${version}" >> $GITHUB_ENV | ||
| fi | ||
| run: printf 'VERSION=%s\n' "${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Update manifest.json version | ||
| if: github.event_name == 'push' | ||
| uses: jossef/action-set-json-field@v2.2 | ||
| with: | ||
| file: src/manifest.json | ||
| field: version | ||
| value: ${{ env.VERSION }} | ||
|
|
||
| - name: Update manifest.v2.json version | ||
| if: github.event_name == 'push' | ||
| uses: jossef/action-set-json-field@v2.2 | ||
| with: | ||
| file: src/manifest.v2.json | ||
| field: version | ||
| value: ${{ env.VERSION }} | ||
|
|
||
| - name: Push files | ||
| if: github.event_name == 'push' | ||
| continue-on-error: true | ||
| run: | | ||
|
PeterDaveHello marked this conversation as resolved.
|
||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
| git config --global user.name "github-actions[bot]" | ||
| git commit -am "release v${{ env.VERSION }}" | ||
| git push | ||
| git add src/manifest.json src/manifest.v2.json | ||
| if git diff --cached --quiet; then | ||
| echo "No release version changes to commit" | ||
| else | ||
| git commit -m "release v${VERSION}" | ||
| git fetch origin master | ||
| git rebase FETCH_HEAD | ||
| git push origin HEAD:master | ||
|
qodo-code-review[bot] marked this conversation as resolved.
|
||
| fi | ||
|
|
||
| - if: github.event_name == 'push' | ||
| run: | | ||
| gh release create ${{github.ref_name}} -d -F CURRENT_CHANGE.md -t ${{github.ref_name}} | ||
| - name: Checkout release tag for artifacts | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ github.ref }} | ||
| persist-credentials: false | ||
|
|
||
| - run: npm ci | ||
|
|
||
| - name: Update release artifact manifest.json version | ||
| uses: jossef/action-set-json-field@v2.2 | ||
| with: | ||
| file: src/manifest.json | ||
| field: version | ||
| value: ${{ env.VERSION }} | ||
|
|
||
| - name: Update release artifact manifest.v2.json version | ||
| uses: jossef/action-set-json-field@v2.2 | ||
| with: | ||
| file: src/manifest.v2.json | ||
| field: version | ||
| value: ${{ env.VERSION }} | ||
|
|
||
|
PeterDaveHello marked this conversation as resolved.
|
||
| - run: | | ||
| gh release create "$RELEASE_TAG" -d -F CURRENT_CHANGE.md -t "$RELEASE_TAG" | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RELEASE_TAG: ${{ github.ref_name }} | ||
|
Comment on lines
+113
to
+117
Contributor
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. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
gh release view --help | head -30
gh release upload --help | rg -n 'clobber'Repository: ChatGPTBox-dev/chatGPTBox Length of output: 1478 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect the relevant workflow sections with line numbers.
sed -n '100,150p' .github/workflows/tagged-release.yml | cat -n
# Locate all release-related gh commands in the workflow.
rg -n 'gh release (view|create|upload|delete|edit|list)' .github/workflows/tagged-release.ymlRepository: ChatGPTBox-dev/chatGPTBox Length of output: 3068 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '100,150p' .github/workflows/tagged-release.yml | cat -n
rg -n 'gh release (view|create|upload|delete|edit|list)' .github/workflows/tagged-release.ymlRepository: ChatGPTBox-dev/chatGPTBox Length of output: 3068 Make the release steps rerunnable. If a build or submission step fails, the draft release and any uploaded assets stick around. A rerun will then fail on 🤖 Prompt for AI Agents |
||
|
|
||
| - uses: actions/setup-python@v6 | ||
| if: github.event_name == 'push' | ||
| with: | ||
| python-version: '3.10' # for appdmg | ||
| - uses: maxim-lobanov/setup-xcode@v1 | ||
| if: github.event_name == 'push' | ||
| with: | ||
| xcode-version: 16.2 | ||
| - if: github.event_name == 'push' | ||
| run: sed -i '' "s/0.0.0/${{ env.VERSION }}/g" safari/project.pre.patch | ||
| - if: github.event_name == 'push' | ||
| run: sed -i '' "s/0.0.0/${{ env.VERSION }}/g" safari/project.patch | ||
| - if: github.event_name == 'push' | ||
| run: npm run build:safari | ||
|
|
||
| - if: github.event_name != 'push' | ||
| run: npm run build | ||
| - run: sed -i '' "s/0.0.0/${VERSION}/g" safari/project.pre.patch | ||
| - run: sed -i '' "s/0.0.0/${VERSION}/g" safari/project.patch | ||
| - run: npm run build:safari | ||
|
|
||
| - run: npm run release:firefox-sources | ||
|
|
||
| - if: github.event_name == 'push' | ||
| run: | | ||
| gh release upload ${{github.ref_name}} build/chromium.zip | ||
| gh release upload ${{github.ref_name}} build/firefox.zip | ||
| gh release upload ${{github.ref_name}} build/safari.dmg | ||
| gh release upload ${{github.ref_name}} build/chromium-without-katex-and-tiktoken.zip | ||
| gh release upload ${{github.ref_name}} build/firefox-without-katex-and-tiktoken.zip | ||
| - run: | | ||
| gh release upload "$RELEASE_TAG" build/chromium.zip | ||
| gh release upload "$RELEASE_TAG" build/firefox.zip | ||
| gh release upload "$RELEASE_TAG" build/safari.dmg | ||
| gh release upload "$RELEASE_TAG" build/chromium-without-katex-and-tiktoken.zip | ||
| gh release upload "$RELEASE_TAG" build/firefox-without-katex-and-tiktoken.zip | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RELEASE_TAG: ${{ github.ref_name }} | ||
|
|
||
| - name: Submit stores | ||
| if: github.event_name == 'push' || inputs.submit_stores == 'true' | ||
| run: | | ||
| args=() | ||
| if [ "${{ github.event_name }}" != "push" ]; then | ||
| if [ "${{ inputs.dry_run }}" != "true" ]; then | ||
| echo "::error::Manual store submission only supports dry_run=true. Push a v* tag for a real submission." | ||
| exit 1 | ||
| fi | ||
| args+=(--dry-run) | ||
| fi | ||
| npm run release:submit -- "${args[@]}" | ||
| run: npm run release:submit | ||
| env: | ||
| CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }} | ||
| CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }} | ||
|
|
@@ -137,6 +157,8 @@ jobs: | |
| EDGE_CLIENT_ID: ${{ secrets.EDGE_CLIENT_ID }} | ||
| EDGE_API_KEY: ${{ secrets.EDGE_API_KEY }} | ||
|
|
||
| - if: github.event_name == 'push' | ||
| run: | | ||
| gh release edit ${{github.ref_name}} --draft=false | ||
| - run: | | ||
| gh release edit "$RELEASE_TAG" --draft=false | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RELEASE_TAG: ${{ github.ref_name }} | ||
Uh oh!
There was an error while loading. Please reload this page.