|
| 1 | +name: "Build .deb artifacts (dev)" |
| 2 | + |
| 3 | +"on": |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + |
| 7 | +# Avoid stacking dispatches when commits land in quick succession. |
| 8 | +# Note: this cancels pending dispatches, not the builds themselves on the |
| 9 | +# release-build-scripts side. Each dispatch that does fire builds to its own |
| 10 | +# SHA-keyed S3 prefix, so there's no artifact conflict either way. |
| 11 | +concurrency: |
| 12 | + group: dev-deb-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + dispatch: |
| 20 | + name: Dispatch .deb build |
| 21 | + runs-on: ubuntu-latest |
| 22 | + env: |
| 23 | + GH_TOKEN: ${{ secrets.ORG_AUTOMATION_TOKEN }} |
| 24 | + WORKFLOW_REPO: timescale/release-build-scripts |
| 25 | + WORKFLOW_FILE: timescaledb-apt.yml |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 28 | + |
| 29 | + - name: Compute build inputs |
| 30 | + id: compute |
| 31 | + run: | |
| 32 | + set -euo pipefail |
| 33 | + BASE=$(grep '^version = ' version.config | sed 's!^version = !!') |
| 34 | + if [ -z "$BASE" ]; then |
| 35 | + echo "::error::Could not extract version from version.config" |
| 36 | + exit 1 |
| 37 | + fi |
| 38 | + SHORT="${GITHUB_SHA:0:8}" |
| 39 | + # ~ sorts before any character in Debian version comparison, so this |
| 40 | + # always orders before any GA release of the same base version. |
| 41 | + DEV_VERSION="${BASE}~dev.g${SHORT}" |
| 42 | + # Replace / in branch names (e.g. users/brent/foo) for S3-friendly keys |
| 43 | + BRANCH_KEY="${GITHUB_REF_NAME//\//_}" |
| 44 | + echo "version=${DEV_VERSION}" >> "$GITHUB_OUTPUT" |
| 45 | + echo "short-sha=${SHORT}" >> "$GITHUB_OUTPUT" |
| 46 | + echo "branch-key=${BRANCH_KEY}" >> "$GITHUB_OUTPUT" |
| 47 | + echo "Building version: ${DEV_VERSION} from sha ${GITHUB_SHA}" |
| 48 | +
|
| 49 | + - name: Dispatch build |
| 50 | + env: |
| 51 | + VERSION: ${{ steps.compute.outputs.version }} |
| 52 | + run: | |
| 53 | + set -euo pipefail |
| 54 | + gh workflow run "${WORKFLOW_FILE}" \ |
| 55 | + -R "${WORKFLOW_REPO}" \ |
| 56 | + -f version="${VERSION}" \ |
| 57 | + -f commit="${GITHUB_SHA}" \ |
| 58 | + -f skip-dev-guards=true \ |
| 59 | + -f matrix-mode=slim \ |
| 60 | + -f upload-mode=s3 \ |
| 61 | + -f s3-bucket=timescaledb-build-artifacts \ |
| 62 | + -f s3-prefix="builds/${GITHUB_SHA}" \ |
| 63 | + -f aws-role-arn="${{ secrets.TIMESCALEDB_CI_S3_WRITER }}" |
| 64 | +
|
| 65 | + - name: Summary |
| 66 | + if: always() |
| 67 | + env: |
| 68 | + VERSION: ${{ steps.compute.outputs.version }} |
| 69 | + run: | |
| 70 | + { |
| 71 | + echo "## Dispatched dev .deb build" |
| 72 | + echo "" |
| 73 | + echo "**Version:** \`${VERSION}\`" |
| 74 | + echo "**Build workflow:** https://github.com/${WORKFLOW_REPO}/actions/workflows/${WORKFLOW_FILE}" |
| 75 | + echo "**S3 prefix (after build completes):** \`s3://timescaledb-build-artifacts/builds/${GITHUB_SHA}/\`" |
| 76 | + echo "**Public URL prefix:** https://timescaledb-build-artifacts.s3.amazonaws.com/builds/${GITHUB_SHA}/" |
| 77 | + echo "**Manifest URL (after build completes):** https://timescaledb-build-artifacts.s3.amazonaws.com/manifests/${GITHUB_SHA}.json" |
| 78 | + } >> "$GITHUB_STEP_SUMMARY" |
0 commit comments