diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a716d25..f9b04a9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,6 @@ version: 2 updates: - - package-ecosystem: "cargo" directory: "/" schedule: @@ -13,3 +12,8 @@ updates: interval: "daily" # This may become too noisy if we start picking up untagged commits. # Watch https://github.com/dependabot/dependabot-core/issues/1639. + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 58e076c..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: Publish release - -on: - workflow_dispatch: - -jobs: - publish: - concurrency: publish-mutex - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: true - token: ${{ secrets.GH_ADMIN_COMMIT_TOKEN }} - - - name: Get latest existing tag - uses: WyriHaximus/github-action-get-previous-tag@v1 - id: get-latest-tag - - - name: Set new version - uses: paulhatch/semantic-version@v5.4.0 - id: set-version - with: - tag_prefix: "v" - version_format: "${major}.${minor}.${patch}" - major_pattern: "(MAJOR)" - minor_pattern: "(MINOR)" - - - name: Generate changelog since last tag - id: generate-changelog - run: | - { - echo 'changelog<> "$GITHUB_OUTPUT" - - - name: Log version & changelog - run: | - echo "Version: $VERSION" - echo "Version tag: $VERSION_TAG" - echo "Latest tag detected: $LATEST_TAG" - echo "Changelog: $CHANGELOG" - env: - VERSION: ${{ steps.set-version.outputs.version }} - VERSION_TAG: ${{ steps.set-version.outputs.version_tag }} - LATEST_TAG: ${{ steps.get-latest-tag.outputs.tag }} - CHANGELOG: ${{ steps.generate-changelog.outputs.changelog }} - - - name: Prevent empty release - if: ${{ steps.generate-changelog.outputs.changelog == '' }} - uses: actions/github-script@v7 - with: - script: | - core.setFailed("No changes since prior release") - - - name: Update changelog - run: | - (head -8 CHANGELOG.md && echo "## $VERSION" && date "+_%d %B %Y_" && echo "" && (echo "$CHANGELOG" | sed -E 's_\(#([0-9]+)\)_([#\1](https://github.com/adobe/xmp-toolkit-rs/pull/\1)\)_') && echo "" && tail -n +9 CHANGELOG.md) > CHANGELOG.new.md - mv CHANGELOG.new.md CHANGELOG.md - env: - VERSION: ${{ steps.set-version.outputs.version }} - CHANGELOG: ${{ steps.generate-changelog.outputs.changelog }} - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable - - - name: Bump crate versions - run: | - sed -i "s/^version = \"[^\"]*\"$/version = \"$VERSION\"/;" Cargo.toml - sed -i "s/^xmp_toolkit = \"[^\"]*\"$/xmp_toolkit = \"$VERSION\"/;" README.md - env: - VERSION: ${{ steps.set-version.outputs.version }} - - - name: Report differences for "prepare (release)" commit - run: git diff - - - name: Commit Cargo.toml and changelog - uses: stefanzweifel/git-auto-commit-action@v5 - id: commit - with: - commit_message: Prepare ${{ steps.set-version.outputs.version }} release - commit_user_name: Adobe CAI Team - commit_user_email: noreply@adobe.com - - - name: Ensure semantic versioning requirements are met - uses: obi1kenobi/cargo-semver-checks-action@v2 - with: - package: xmp_toolkit - - - name: Create release - uses: ncipollo/release-action@v1 - with: - body: ${{ steps.generate-changelog.outputs.changelog }} - commit: ${{ steps.commit.outputs.commit_hash }} - tag: ${{ steps.set-version.outputs.version_tag }} - token: ${{ secrets.GH_ADMIN_COMMIT_TOKEN }} - - - name: Populate git submodules - run: git submodule init && git submodule update - - - name: Publish crate - run: | - cargo publish --token $CRATES_IO_SECRET - env: - CRATES_IO_SECRET: ${{ secrets.CRATES_IO_SECRET }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7de5217 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: Release-plz + +permissions: + pull-requests: write + contents: write + +on: + push: + branches: + - main + +jobs: + release-plz: + name: Release-plz + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Run release-plz + uses: MarcoIeni/release-plz-action@v0.5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index d7ff60b..9e51fdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ # Changelog -All changes to this project are documented in this file. +All notable changes to this project will be documented in this file. -This project adheres to [Semantic Versioning](https://semver.org), except that – as is typical in the Rust community – the minimum supported Rust version may be increased without a major version increase. +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), except that – as is typical in the Rust community – the minimum supported Rust version may be increased without a major version increase. + +Since version 1.9.1, the format of this changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). Do not manually edit this file. It will be automatically updated when a new release is published. diff --git a/release-plz.toml b/release-plz.toml new file mode 100644 index 0000000..9b96ce8 --- /dev/null +++ b/release-plz.toml @@ -0,0 +1,15 @@ +[changelog] +body = """ +## [{{ version | trim_start_matches(pat="v") }}]{%- if release_link -%}({{ release_link }}){% endif %} +_{{ timestamp | date(format="%d %B %Y") }}_ +{% for group, commits in commits | group_by(attribute="group") %} +### {{ group | upper_first }} +{% for commit in commits %} +{%- if commit.scope -%} +* *({{commit.scope}})* {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }}{%- if commit.links %} ({% for link in commit.links %}[{{link.text}}]({{link.href}}) {% endfor -%}){% endif %} +{% else -%} +* {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }} +{% endif -%} +{% endfor -%} +{% endfor %} +"""