Skip to content

Commit 45b36bd

Browse files
committed
chore(release): prepare v2.0.0
This preparation also includes some tweaks to the release workflow, as it was being used for the first time and debugged. Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 52cfb07 commit 45b36bd

File tree

5 files changed

+65
-63
lines changed

5 files changed

+65
-63
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,15 @@ jobs:
4747
if: needs.check-release.outputs.is-release == 'true'
4848
runs-on: ubuntu-latest
4949
environment: crates-io
50+
permissions:
51+
id-token: write
5052

5153
steps:
5254
- name: Checkout
5355
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5456
with:
5557
fetch-depth: 0
58+
persist-credentials: false
5659

5760
- name: Install Rust
5861
uses: dtolnay/rust-toolchain@stable
@@ -66,9 +69,22 @@ jobs:
6669
uses: rust-lang/crates-io-auth-action@b7e9a28eded4986ec6b1fa40eeee8f8f165559ec # v1.0.3
6770
id: auth
6871

72+
- name: Generate GitHub App token
73+
id: app-token
74+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
75+
with:
76+
app-id: ${{ secrets.RELEASE_APP_ID }}
77+
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
78+
79+
- name: Configure git identity
80+
env:
81+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
82+
run: |
83+
git config user.name "${{ steps.app-token.outputs.app-slug }}[bot]"
84+
git config user.email "$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq '.id')+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
85+
6986
- name: Publish release
7087
env:
7188
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
72-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
7490
run: ./scripts/ci/publish-release "${{ needs.check-release.outputs.version }}"

CHANGELOG.md

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,32 @@ All notable changes to this project will be documented in this file.
44

55
<!-- markdownlint-disable -->
66

7-
## [amber-api/v1.0.0] _2025-08-06_
7+
## [amber-api/v2.0.0] _2026-01-25_
88

99
### 🚀 Features
1010

11-
- Add models
12-
- Add core configuration models
13-
- Add display
14-
- Add client
15-
- Add is_ and as_ function to enums
11+
- Retry on 429
12+
- [**breaking**] Go async
1613

17-
### 📚 Documentation
14+
### 🎨 Styling
1815

19-
- Add amber 2.0.0 oad
20-
- Add missing models
21-
- Minor tweaks
22-
- Creation
23-
- Add ferris logo to readme
24-
- Fix cargo categories
25-
26-
- Manual change to the changelog
16+
- Update comments
2717

2818
### ⚙️ Miscellaneous Tasks
2919

30-
- Add groundwork
31-
- Add copilot instructions
32-
- Simplify dotenv
33-
- Deny warnings in pre-commit
34-
- Add deserialization unit tests
35-
- Remove dummy test
36-
- _(ci)_ Add amber api key
37-
- Add tracing information
38-
- _(tests)_ Add integration tests
39-
- _(ci)_ Adapt retries in CI
40-
- _(ci)_ Disable fail fast
41-
- Add examples
42-
- _(ci)_ Include examples
43-
- _(ci)_ Fix coverage checks
44-
- _(ci)_ Upload to codecov
45-
- _(ci)_ Further increase retry delay
46-
- Add missing markdownlint re-enable
20+
- _(ci)_ Reduce number of tests
21+
- Fix failing test
22+
- Silence clippy false positive
23+
- Fix json schema url
24+
- Add rust instructions
25+
- Use proper version in user agent
26+
- _(ci)_ Add release pipeline
27+
- Remove unused prek hook
28+
- _(ci)_ Increase tarpaulin timeout
29+
- Optimize changelog logic
4730

4831
### Contributors
4932

5033
- @JP-Ellis
34+
35+
<!-- generated by git-cliff on 2026-01-25 -->

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name = "amber-api"
55
description = "Rust client for Amber Electric's API"
66
license = "MIT"
77
readme = "README.md"
8-
version = "1.0.0"
8+
version = "2.0.0"
99

1010
categories = ["api-bindings"]
1111
keywords = ["amber", "amber-electric", "api"]

scripts/ci/lib.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,28 @@ ci_append_output() {
7272
printf '%s\n' "$@" >>"${GITHUB_OUTPUT}"
7373
fi
7474
}
75+
76+
# Authenticate git with GitHub using a token
77+
#
78+
# GitHub Actions provide a `GITHUB_TOKEN` secret by default, but if a custom
79+
# token is provided via the `GH_TOKEN` environment variable (e.g., to
80+
# authenticate an app or user), this function configures git to use it instead.
81+
#
82+
# Usage:
83+
# configure_git_auth
84+
#
85+
# Environment Variables:
86+
# GH_TOKEN - (optional) GitHub token to use for git authentication. If not
87+
# set, this function does nothing.
88+
#
89+
# Returns:
90+
# 0 - Always
91+
#
92+
configure_git_auth() {
93+
if [ -n "${GH_TOKEN-}" ]; then
94+
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/$(git remote get-url origin | sed -E 's#https://github.com/##')"
95+
info "Configured git authentication using GH_TOKEN"
96+
else
97+
info "GH_TOKEN not set; skipping git authentication configuration"
98+
fi
99+
}

scripts/ci/publish-release

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,6 @@ if [ "$DRY_RUN" = false ]; then
106106
fi
107107
fi
108108

109-
################################################################################
110-
## Run Tests
111-
################################################################################
112-
113-
if [ "$DRY_RUN" = false ]; then
114-
info "Running tests"
115-
ensure cargo test --all-features
116-
info "Tests passed"
117-
else
118-
info "Dry-run: Skipping tests"
119-
fi
120-
121109
################################################################################
122110
## Extract Changelog
123111
################################################################################
@@ -150,6 +138,8 @@ debug "Changelog excerpt:\n$CHANGELOG_SECTION"
150138
## Create Git Tag
151139
################################################################################
152140

141+
configure_git_auth
142+
153143
TAG_NAME=$(format_tag_name "$VERSION")
154144
info "Creating git tag: $TAG_NAME"
155145

@@ -204,23 +194,9 @@ info "Publishing to crates.io"
204194

205195
if [ "$DRY_RUN" = false ]; then
206196
if [ -n "${CARGO_REGISTRY_TOKEN-}" ]; then
207-
if cargo publish --token "${CARGO_REGISTRY_TOKEN}"; then
208-
info "Successfully published to crates.io"
209-
210-
# Verify publication
211-
info "Verifying publication on crates.io"
212-
sleep 5 # Give crates.io a moment to index
213-
214-
if curl -sf "https://crates.io/api/v1/crates/amber-api" >/dev/null; then
215-
info "Verified crate is available on crates.io"
216-
else
217-
warn "Could not verify crate on crates.io (may take a few minutes to index)"
218-
fi
219-
else
220-
err "Failed to publish to crates.io"
221-
fi
197+
ensure cargo publish --token "${CARGO_REGISTRY_TOKEN}"
222198
else
223-
warn "CARGO_REGISTRY_TOKEN not set, skipping crates.io publish"
199+
ensure cargo publish
224200
fi
225201
else
226202
info "Would publish to crates.io"

0 commit comments

Comments
 (0)