Repository navigation
fix(ci): build/prod updates with each PlaceOS release, and stops stalling on e2e timeouts #343
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| # Builds the application and its changelog, and uploads them as the | ||
| # `build-output` artifact. BUILD (develop) and RELEASE (PlaceOS releases) call | ||
| # this workflow, then publish the artifact to a build/* branch. | ||
| name: BUILD APP | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| ref: | ||
| description: 'Commit to build. Empty: the commit that started the run' | ||
| type: string | ||
| default: '' | ||
| configuration: | ||
| description: 'Angular build configuration: development or production' | ||
| type: string | ||
| required: true | ||
| tag: | ||
| description: 'Release tag to add to the commit before the build. The version info shows it' | ||
| type: string | ||
| default: '' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 3 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ inputs.ref }} | ||
|
|
||
| # The changelog needs the history and tags of this commit only. | ||
| # fetch-depth: 0 also downloads the build/* deploy branches (about | ||
| # 560 MB against 30 MB). | ||
| - name: Fetch history and tags | ||
| env: | ||
| REF: ${{ inputs.ref || github.ref }} | ||
| run: git fetch --unshallow --tags origin "$REF" | ||
|
|
||
| # Local only. config/version.js (git describe) and git-cliff read | ||
| # it. RELEASE pushes the tag after the deploy. --force: a retry of | ||
| # a release fetches the tag that the first run pushed. | ||
| - name: Tag the release | ||
| if: inputs.tag != '' | ||
| env: | ||
| TAG: ${{ inputs.tag }} | ||
| run: git tag --force "$TAG" | ||
|
|
||
| - name: Setup Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: '1.3.11' | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install --frozen-lockfile | ||
|
|
||
| - name: Setup version | ||
| run: bun run postinstall | ||
|
|
||
| - name: Install git-cliff | ||
| uses: taiki-e/install-action@v2 | ||
| with: | ||
| tool: git-cliff@2.13.1 | ||
|
|
||
| - name: Initialise Pipeline Chat Status | ||
| uses: fjogeleit/http-request-action@master | ||
| continue-on-error: true | ||
| with: | ||
| url: ${{ secrets.STATUS_URL }} | ||
| data: '{ "chat_url": "${{ secrets.CHAT_URL }}", "name": "${{ github.repository }}", "commit": "${{ github.sha }}", "pipeline_name": "backoffice", "branch": "${{ github.ref }}", "status": "processing", "url": "https://github.com/${{ github.repository }}/runs/${{ github.run_id }}" }' | ||
|
|
||
| # Do not restore an Nx cache for this build. Nx does not hash the | ||
| # gitignored src/env/version.ts, so a cached build could deploy | ||
| # the version info of an earlier commit. | ||
| # git-cliff runs alongside the build; `wait` fails the step if it fails. | ||
| # Do not set GITHUB_REPO. cliff.toml uses no GitHub metadata, and | ||
| # the unauthenticated metadata requests hit the API rate limit. | ||
| - name: Build application and changelog | ||
| env: | ||
| CONFIGURATION: ${{ inputs.configuration }} | ||
| run: | | ||
| git-cliff --config cliff.toml --output "${RUNNER_TEMP}/CHANGELOG.md" & | ||
| cliff_pid=$! | ||
| bun run build -- --verbose --configuration="$CONFIGURATION" | ||
| wait "$cliff_pid" | ||
|
|
||
| - name: Add application changelog to build | ||
| run: cp "${RUNNER_TEMP}/CHANGELOG.md" dist/backoffice/browser/CHANGELOG.md | ||
|
|
||
| # Upload source maps so Sentry shows the original code. Skipped | ||
| # until the SENTRY_* secrets are set. Debug IDs change the scripts, | ||
| # so the service worker hashes are updated after. Development | ||
| # builds have no service worker. | ||
| # The release name must match SENTRY_RELEASE in src/app/common/sentry.ts. | ||
| - name: Upload source maps to Sentry | ||
| env: | ||
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||
| SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | ||
| SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | ||
| run: | | ||
| if [ -z "$SENTRY_AUTH_TOKEN" ] || [ -z "$SENTRY_ORG" ] || [ -z "$SENTRY_PROJECT" ]; then | ||
| echo "SENTRY_AUTH_TOKEN, SENTRY_ORG or SENTRY_PROJECT is not set. Skipping upload." | ||
| exit 0 | ||
| fi | ||
| release=$(bun -e "import { VERSION } from './src/env/version.ts'; console.log('backoffice@' + VERSION.hash)") | ||
| bunx sentry-cli sourcemaps inject dist/backoffice/browser | ||
| if [ -f dist/backoffice/browser/ngsw.json ]; then | ||
| bun config/ngsw-rehash.js dist/backoffice/browser | ||
| fi | ||
| bunx sentry-cli sourcemaps upload --release="$release" dist/backoffice/browser | ||
|
|
||
| # Production builds make hidden source maps for Sentry only | ||
| - name: Remove hidden source maps | ||
| if: inputs.configuration != 'development' | ||
| run: find dist/backoffice/browser -name '*.map' -delete | ||
|
|
||
| - name: Upload build artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: build-output | ||
| path: dist/backoffice/browser | ||
| retention-days: 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.