name: Upload Artifacts run-name: Canary release ${{github.sha}} upload permissions: contents: write on: workflow_run: workflows: - CI types: - completed branches: - main jobs: upload: if: ${{ github.repository_owner == 'oven-sh' }} name: Upload Artifacts runs-on: ubuntu-latest steps: - name: Download Artifacts uses: actions/download-artifact@v4 with: path: bun pattern: bun-* merge-multiple: true github-token: ${{ github.token }} run-id: ${{ github.event.workflow_run.id }} - name: Check for Artifacts run: | if [ ! -d "bun" ] || [ -z "$(ls -A bun)" ]; then echo "Error: No artifacts were downloaded or 'bun' directory does not exist." exit 1 # Fail the job if the condition is met else echo "Artifacts downloaded successfully." fi - name: Upload to GitHub Releases uses: ncipollo/release-action@v1 with: tag: canary name: Canary (${{ github.sha }}) prerelease: true body: This canary release of Bun corresponds to the commit [${{ github.sha }}] allowUpdates: true replacesArtifacts: true generateReleaseNotes: true artifactErrorsFailBuild: true artifacts: bun/**/bun-*.zip token: ${{ github.token }} - name: Upload to S3 (using SHA) uses: shallwefootball/s3-upload-action@4350529f410221787ccf424e50133cbc1b52704e with: endpoint: ${{ secrets.AWS_ENDPOINT }} aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}} aws_bucket: ${{ secrets.AWS_BUCKET }} source_dir: bun destination_dir: releases/${{ github.event.workflow_run.head_sha || github.sha }}-canary - name: Upload to S3 (using tag) uses: shallwefootball/s3-upload-action@4350529f410221787ccf424e50133cbc1b52704e with: endpoint: ${{ secrets.AWS_ENDPOINT }} aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}} aws_bucket: ${{ secrets.AWS_BUCKET }} source_dir: bun destination_dir: releases/canary - name: Announce on Discord uses: sarisia/actions-status-discord@v1 with: webhook: ${{ secrets.BUN_DISCORD_GITHUB_CHANNEL_WEBHOOK }} nodetail: true color: "#1F6FEB" title: "New Bun Canary available" url: https://github.com/oven-sh/bun/commit/${{ github.sha }} description: | A new canary build of Bun has been automatically uploaded. To upgrade, run: ```sh bun upgrade --canary # bun upgrade --stable <- to downgrade ``` # If notifying sentry fails, don't fail the rest of the build. - name: Notify Sentry uses: getsentry/action-release@v1.7.0 env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_ORG: ${{ secrets.SENTRY_ORG }} SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} with: ignore_missing: true ignore_empty: true version: ${{ github.event.workflow_run.head_sha || github.sha }}-canary environment: canary