-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
283e2f9
commit dab342d
Showing
3 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: "Create release" | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
create_release: | ||
name: Create from merged release branch | ||
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2.3.4 | ||
|
||
- name: Extract version from branch name | ||
id: extract-version | ||
shell: python | ||
run: | | ||
branch_name = "${{ github.event.pull_request.head.ref }}" | ||
version = branch_name.split("/")[1] | ||
print(f"::set-output name=version::{version}") | ||
- name: Extract changelog section for release | ||
id: changelog | ||
uses: coditory/changelog-parser@v1 | ||
with: | ||
version: ${{ steps.extract-version.outputs.version }} | ||
|
||
- name: Create GitHub release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.extract-version.outputs.version }} | ||
release_name: ${{ steps.extract-version.outputs.version }} | ||
draft: false | ||
prerelease: false | ||
body: ${{ steps.changelog.outputs.description }} | ||
commitish: ${{ github.event.pull_request.merge_commit_sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: "Draft new release" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'The new version in X.Y.Z format.' | ||
required: true | ||
|
||
jobs: | ||
draft-new-release: | ||
name: "Draft a new release" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2.3.4 | ||
|
||
- name: Create release branch | ||
run: git checkout -b release/${{ github.event.inputs.version }} | ||
|
||
- name: Update changelog | ||
uses: thomaseizinger/keep-a-changelog-new-release@1.2.1 | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
changelogPath: CHANGELOG.md | ||
|
||
- name: Initialize mandatory git config | ||
run: | | ||
git config user.name "Thomas Eizinger" | ||
git config user.email thomas@eizinger.io | ||
- name: Bump version in Cargo.toml | ||
uses: thomaseizinger/set-crate-version@1.0.0 | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
manifest: Cargo.toml | ||
|
||
- name: Commit changelog and manifest files | ||
id: make-commit | ||
run: | | ||
curl -fsSL https://dprint.dev/install.sh | sh | ||
/home/runner/.dprint/bin/dprint fmt | ||
git add CHANGELOG.md Cargo.toml | ||
git commit --message "Prepare release ${{ github.event.inputs.version }}" | ||
echo "::set-output name=commit::$(git rev-parse HEAD)" | ||
- name: Push new branch | ||
run: git push origin release/${{ github.event.inputs.version }} --force | ||
|
||
- name: Create pull request | ||
uses: thomaseizinger/create-pull-request@1.1.0 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
head: release/${{ github.event.inputs.version }} | ||
base: master | ||
title: Release version ${{ github.event.inputs.version }} | ||
reviewers: ${{ github.actor }} | ||
body: | | ||
Hi @${{ github.actor }}! | ||
This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}. | ||
I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit }}. | ||
Merging this PR will create a GitHub release and publish the library to crates.io! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: "Release to crates.io" | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout tagged commit | ||
uses: actions/checkout@v2.3.4 | ||
with: | ||
ref: ${{ github.event.release.target_commitish }} | ||
|
||
- run: cargo publish --dry-run | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |