name: Release on: push: branches: - main workflow_dispatch: permissions: contents: write # for actions/checkout and adding tag id-token: write jobs: build-native-linux: strategy: fail-fast: false matrix: include: # Linux AMD64 - name: x86_64-unknown-linux-gnu target: x86_64-unknown-linux-gnu os: ubuntu-22.04 # Linux ARM64 - name: aarch64-unknown-linux-gnu target: aarch64-unknown-linux-gnu os: ubuntu-22.04-arm # # Linux ARM # We don't support 32 bit linux # - name: arm-unknown-linux-gnueabihf # os: ubuntu-22.04 # target: arm-unknown-linux-gnueabihf # run: apt install -y gcc-arm-linux-gnueabihf name: ${{ matrix.name }} runs-on: ${{ matrix.os }} container: image: node:22-bullseye steps: - uses: actions/checkout@v4 - name: Verify container dependencies # Use the full Node Bullseye image so this job does not depend on apt # mirrors during release builds. It includes Node, Yarn, curl, git and # the native build toolchain from buildpack-deps. run: | node --version npm --version yarn --version git --version curl --version gcc --version g++ --version make --version - name: Free up space # This build uses a debian image that's different than the Ubuntu image for the CI jobs # The __t directory contains a bunch of pre-installed tools like Go, Python, Node etc that we don't use in our builds. # Removing this directory frees up some 25GB of space. run: | rm -rf /var/lib/apt/lists/* /__t/* - name: Install Rust uses: ./.github/actions/rust-toolchain with: targets: ${{ matrix.target }} - uses: ./.github/actions/setup-node with: node-version: 22 - uses: Swatinem/rust-cache@v2 with: shared-key: '${{ matrix.name }}' # Only store new caches on main save-if: ${{ github.ref == 'refs/heads/main' }} - name: Build native packages env: RUSTUP_TARGET: ${{ matrix.target }} CARGO_PROFILE: release run: yarn build-native - name: Upload debug symbols to sentry run: node "./scripts/debug-symbols.mjs" --upload-to-sentry --rm env: SENTRY_ORG: ${{secrets.SENTRY_ORG}} SENTRY_PROJECT: ${{secrets.SENTRY_PROJECT}} SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}} - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: packages-${{ matrix.target }} path: packages/**/* build-native-macos: strategy: fail-fast: false matrix: include: # MACOS ARM64 - name: aarch64-apple-darwin target: aarch64-apple-darwin # MACOS AMD64 - name: x86_64-apple-darwin target: x86_64-apple-darwin name: ${{ matrix.name }} runs-on: macos-latest steps: - uses: actions/checkout@v4 - name: Install Rust uses: ./.github/actions/rust-toolchain with: targets: ${{ matrix.target }} - uses: ./.github/actions/setup-node - uses: Swatinem/rust-cache@v2 with: shared-key: '${{ matrix.name }}' # Only store new caches on main save-if: ${{ github.ref == 'refs/heads/main' }} - name: Build native packages env: RUSTUP_TARGET: ${{ matrix.target }} CARGO_PROFILE: release run: yarn build-native - name: Upload debug symbols to sentry run: node "./scripts/debug-symbols.mjs" --upload-to-sentry --rm env: SENTRY_ORG: ${{secrets.SENTRY_ORG}} SENTRY_PROJECT: ${{secrets.SENTRY_PROJECT}} SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}} - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: packages-${{ matrix.target }} path: packages/**/* build-and-release-changesets: name: Build and release Changesets if: github.ref_name == 'main' needs: - build-native-linux - build-native-macos runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 with: fetch-depth: 0 persist-credentials: false - uses: actions/create-github-app-token@v2 id: app-token with: app-id: ${{ vars.ATLASPACK_CI_APP_ID }} private-key: ${{ secrets.ATLASPACK_CI_PRIVATE_KEY }} - uses: ./.github/actions/setup-node - uses: actions/download-artifact@v4 with: pattern: packages-* path: packages merge-multiple: true - name: Get Artifact Publish Token id: publish-token uses: atlassian-labs/artifact-publish-token@v1.0.1 with: output-modes: npm - name: Set publish registry run: | printf "\n@atlaspack:registry=https://packages.atlassian.com/api/npm/npm-public/\n" >> "${{ github.workspace }}/.npmrc-public" - uses: changesets/action@v1 with: publish: yarn changesets-publish createGithubReleases: false env: GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} # .npmrc-public is generated by atlassian-labs/artifact-publish-token NPM_CONFIG_USERCONFIG: ${{ github.workspace }}/.npmrc-public