Skip to content

Commit

Permalink
Merge pull request #64 from moia-oss/use-release-plz
Browse files Browse the repository at this point in the history
use release plz
  • Loading branch information
rinde authored Oct 9, 2024
2 parents 2b88c19 + 34a6a93 commit 8ea2f9d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 103 deletions.
51 changes: 1 addition & 50 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,53 +43,4 @@ jobs:
shared-key: debug-build-nightly
- name: Make lint
run: make lint
semver:
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- uses: actions/checkout@v4
# Manually extract labels because rymndhng/release-on-push-action can't do this correctly on a PR
- name: Extract labels
id: extract_version_bump
shell: bash
run: |
if [ ${{contains( github.event.pull_request.labels.*.name, 'release:major')}} = true ]; then
echo "bump_version=major" >> $GITHUB_OUTPUT
elif [ ${{contains( github.event.pull_request.labels.*.name, 'release:minor')}} = true ]; then
echo "bump_version=minor" >> $GITHUB_OUTPUT
elif [ ${{contains( github.event.pull_request.labels.*.name, 'norelease')}} = true ]; then
echo "bump_version=" >> $GITHUB_OUTPUT
else
echo "bump_version=patch" >> $GITHUB_OUTPUT
fi
- name: Calculate next version
id: calc_version
if: ${{ steps.extract_version_bump.outputs.bump_version }} != ""
uses: rymndhng/release-on-push-action@master
with:
bump_version_scheme: ${{ steps.extract_version_bump.outputs.bump_version }}
tag_prefix: ""
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Print version
run: |
echo "${{steps.calc_version.outputs.version}} ${{github.event.pull_request.labels}}"
echo "${{ steps.extract_version_bump.outputs.bump_version }}"
echo "${{toJson(github.event.pull_request.labels.*.name)}}"
- name: Set version
if: ${{ steps.extract_version_bump.outputs.bump_version }} != ""
run: |
sed -i "s/^version = \".*\"$/version = \"${{ steps.calc_version.outputs.version }}\"/" Cargo.toml
- name: Commit new version to main but don't push
if: ${{ steps.extract_version_bump.outputs.bump_version }} != ""
run: |
git config --global user.email "[email protected]"
git config --global user.name "MOIA Rust Maintainers"
git commit -am "Phantom release ${{ steps.calc_version.outputs.version }} [skip ci]"
- name: Check semver
if: ${{ steps.extract_version_bump.outputs.bump_version }} != ""
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
version-tag-prefix: ''

53 changes: 0 additions & 53 deletions .github/workflows/publish.yaml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Run Release Plz

permissions:
pull-requests: write
contents: write

on:
push:
branches:
- main

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: taiki-e/install-action@v2
with:
tool: just
- run: |
echo "RUST_TOOLCHAIN=$(just rust-version)" >> $GITHUB_ENV
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Run release-plz
uses: MarcoIeni/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

0 comments on commit 8ea2f9d

Please sign in to comment.