Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

Expand All @@ -49,14 +49,14 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
toolchain: stable
toolchain: 1.98.1
components: clippy
rustflags: ""

Expand All @@ -70,14 +70,14 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
toolchain: stable
toolchain: 1.98.1
components: rustfmt
rustflags: ""

Expand All @@ -91,7 +91,7 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

Expand All @@ -117,7 +117,7 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

Expand All @@ -143,7 +143,7 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

Expand All @@ -169,18 +169,18 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
toolchain: stable
toolchain: 1.98.1
rustflags: ""

- name: Run tests
run: cargo test
run: cargo test --locked

audit:
runs-on: ubuntu-latest
Expand All @@ -189,7 +189,7 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
language: [rust, javascript-typescript, actions]
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gha_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

Expand All @@ -49,7 +49,7 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false

Expand Down
197 changes: 197 additions & 0 deletions .github/workflows/release_please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
name: Release Please

on:
push:
branches:
- main
workflow_dispatch:
inputs:
tag_name:
description: Existing release tag to rebuild artifacts for; run the workflow on the same tag
required: true
type: string

permissions: {}

defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
release-please:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
issues: write
pull-requests: write
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- name: Check release token
env:
RELEASE_PLEASE_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
run: |
set -euo pipefail

if [[ -z "$RELEASE_PLEASE_TOKEN" ]]; then
echo "RELEASE_PLEASE_TOKEN repository secret is required."
exit 1
fi

- name: Create or update release PR
id: release
uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1
with:
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json

release-artifacts:
needs: release-please
if: ${{ always() && (needs.release-please.outputs.release_created == 'true' || github.event_name == 'workflow_dispatch') }}
runs-on: macos-15
timeout-minutes: 30
permissions:
contents: write
id-token: write
attestations: write
env:
CARGO_DIST_VERSION: 0.30.2
TARGET: aarch64-apple-darwin
TAG_NAME: ${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || needs.release-please.outputs.tag_name }}
steps:
- name: Checkout release tag
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
ref: ${{ env.TAG_NAME }}

- name: Verify release ref
run: |
set -euo pipefail

# Provenance must name the tagged commit, so manual rebuilds run on the tag.
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" && "$GITHUB_REF" != "refs/tags/$TAG_NAME" ]]; then
echo "Run manual rebuilds on the tag itself:"
echo " gh workflow run release_please.yml --ref $TAG_NAME -f tag_name=$TAG_NAME"
exit 1
fi

head_sha="$(git rev-parse HEAD)"
if [[ "$head_sha" != "$GITHUB_SHA" ]]; then
echo "$TAG_NAME points to $head_sha, but this run is for $GITHUB_SHA."
exit 1
fi

- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
toolchain: 1.98.1
target: ${{ env.TARGET }}
rustflags: ""

- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0

- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22

- name: Install cargo-dist
run: |
curl --proto '=https' --tlsv1.2 -LsSf \
"https://github.com/axodotdev/cargo-dist/releases/download/v${CARGO_DIST_VERSION}/cargo-dist-installer.sh" \
| sh
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"

- name: Run tests
run: cargo test --locked

- name: Install JXA check dependencies
run: pnpm install --frozen-lockfile

- name: Check embedded JXA
run: pnpm run check

- name: Build release artifacts
run: |
set -euo pipefail

dist build \
--tag "$TAG_NAME" \
--target "$TARGET" \
--artifacts=all \
--output-format=json \
> dist-manifest.json
dist print-upload-files-from-manifest \
--manifest dist-manifest.json \
> dist-upload-files.txt

- name: Smoke test packaged archive
run: |
set -euo pipefail

archive_path="$(
find target/distrib -maxdepth 1 -type f \
\( -name "apple-mail-cli-${TARGET}.tar.xz" -o -name "apple-mail-cli-${TARGET}.tar.gz" \) \
| head -n 1
)"

if [[ -z "$archive_path" ]]; then
echo "apple-mail-cli archive for ${TARGET} was not produced."
exit 1
fi

tmpdir="$(mktemp -d)"

case "$archive_path" in
*.tar.xz)
tar -xJf "$archive_path" -C "$tmpdir" --strip-components=1
;;
*.tar.gz)
tar -xzf "$archive_path" -C "$tmpdir" --strip-components=1
;;
*)
echo "unsupported archive format: $archive_path"
exit 1
;;
esac

"$tmpdir/apple-mail" --version
"$tmpdir/apple-mail" --help

- name: Attest release artifacts
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: target/distrib/*

- name: Upload release artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail

# macOS runners ship Bash 3.2, which has no mapfile.
artifact_paths=()
while IFS= read -r artifact_path; do
artifact_paths+=("$artifact_path")
done < dist-upload-files.txt
if ((${#artifact_paths[@]} == 0)); then
echo "cargo-dist did not report uploadable files."
exit 1
fi

gh release upload "$TAG_NAME" "${artifact_paths[@]}" --clobber

- name: Publish release
env:
GH_TOKEN: ${{ github.token }}
run: gh release edit "$TAG_NAME" --draft=false
3 changes: 3 additions & 0 deletions .ls-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ ignore:
- docs/logs

- README.md
- CONTRIBUTING.md
- CHANGELOG.md
- release-please-config.json
- Cargo.toml
- Cargo.lock

Expand Down
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.0"
}
Loading
Loading