-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add changelog and release workflows (#488)
- Loading branch information
Showing
15 changed files
with
861 additions
and
94 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,15 @@ | ||
issues=true | ||
issues-wo-labels=false | ||
pr-wo-labels=false | ||
author=false | ||
breaking-label=Changed | ||
breaking-labels=Breaking change | ||
enhancement-label=Added | ||
enhancement-labels=Added | ||
bugs-label=Patch | ||
bug-labels=Patch | ||
deprecated-labels=Deprecated | ||
removed-labels=Removed | ||
exclude-labels=Documentation,No changelog | ||
include-labels=Rust | ||
verbose=true |
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,43 @@ | ||
name: 'publish-wasm' | ||
description: 'Publishes Wasm bindings to npm' | ||
inputs: | ||
tag: | ||
description: 'Which npm tag to publish under e.g. `dev`, will default to `latest`' | ||
required: false | ||
npm-token: | ||
description: 'used for authenticating towards npm' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
target: wasm32-unknown-unknown | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Install JS dependencies | ||
shell: sh | ||
run: npm install | ||
working-directory: bindings/wasm | ||
|
||
- name: Build WASM bindings | ||
shell: sh | ||
run: npm run build | ||
working-directory: bindings/wasm | ||
|
||
- name: Publish WASM bindings to NPM | ||
shell: sh | ||
env: | ||
NODE_AUTH_TOKEN: ${{ inputs.npm-token }} | ||
# will publish 'latest' tag if no tag is passed | ||
run: npm publish $(if [ ${{ inputs.tag }} != '' ]; then echo --tag ${{ inputs.tag }}; fi) --access public | ||
working-directory: bindings/wasm |
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,69 @@ | ||
name: 'bump-versions' | ||
description: 'Bump project versions for the release target' | ||
inputs: | ||
release-target: | ||
description: "target of the release (rust|wasm)" | ||
required: true | ||
version: | ||
description: "version to set (e.g. `1.2.3` or `1.2.3-dev.1`)" | ||
required: true | ||
|
||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install Rust stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
|
||
- name: Install cargo-workspaces | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: install | ||
args: --version ^0.2 cargo-workspaces | ||
|
||
- name: Install cargo-edit # to use cargo add | ||
uses: actions-rs/cargo@v1 | ||
if: ${{inputs.release-target == 'rust'}} | ||
with: | ||
command: install | ||
args: -f --no-default-features --features "add" --version ^0.8 cargo-edit | ||
|
||
- name: Replace identity version in Wasm bindings | ||
shell: bash | ||
if: ${{inputs.release-target == 'rust'}} | ||
working-directory: bindings/wasm | ||
run: | | ||
cargo add identity@=${{ inputs.version }} --path=../../identity | ||
- name: Bump Rust crate version | ||
shell: bash | ||
# cargo-release creates a signed commit automatically | ||
if: ${{inputs.release-target == 'rust'}} | ||
run: | | ||
cargo workspaces version --no-git-commit --exact custom ${{ inputs.version }} -y | ||
- name: Bump Wasm bindings crate version | ||
shell: bash | ||
# cargo-release creates a signed commit automatically | ||
if: ${{inputs.release-target == 'wasm'}} | ||
working-directory: bindings/wasm | ||
run: | | ||
cargo workspaces version --no-git-commit --exact custom ${{ inputs.version }} -y | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
if: ${{inputs.release-target == 'wasm'}} | ||
with: | ||
node-version: '16.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Bump Wasm npm package version | ||
shell: bash | ||
if: ${{inputs.release-target == 'wasm'}} | ||
working-directory: bindings/wasm | ||
run: | | ||
npm version ${{ inputs.version }} |
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,50 @@ | ||
name: 'changelog-generator' | ||
description: 'Runs github changelog generator' | ||
inputs: | ||
changelog-path: | ||
description: "path to the changelog file" | ||
required: false | ||
default: ./CHANGELOG.md | ||
changelog-config-path: | ||
description: "path to the changelog config" | ||
required: true | ||
future-release: | ||
description: "release name (e.g. `v1.2.3-dev.1`)" | ||
required: true | ||
optional-arg: | ||
description: "optional argument for the generator command" | ||
required: false | ||
github-token: | ||
description: "token used to call github API" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Prepare Repository For Changelog Generator | ||
shell: bash | ||
run: | | ||
GITHUB_REPOSITORY_USER=$( echo $GITHUB_REPOSITORY | awk -F'/' '{print $1}') | ||
GITHUB_REPOSITORY_PROJECT=$( echo $GITHUB_REPOSITORY | awk -F'/' '{print $2}') | ||
echo GITHUB_REPOSITORY_USER=$GITHUB_REPOSITORY_USER | ||
echo GITHUB_REPOSITORY_PROJECT=$GITHUB_REPOSITORY_PROJECT | ||
echo GITHUB_REPOSITORY_USER=$GITHUB_REPOSITORY_USER >> $GITHUB_ENV | ||
echo GITHUB_REPOSITORY_PROJECT=$GITHUB_REPOSITORY_PROJECT >> $GITHUB_ENV | ||
- name: Run github-changelog-generator | ||
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2 | ||
with: | ||
args: > | ||
--output ${{ inputs.changelog-path }} | ||
--config-file ${{ inputs.changelog-config-path }} | ||
--user ${{ env.GITHUB_REPOSITORY_USER }} | ||
--project ${{ env.GITHUB_REPOSITORY_PROJECT }} | ||
--token ${{ inputs.github-token }} | ||
--future-release ${{ inputs.future-release }} | ||
${{ inputs.optional-arg }} | ||
- name: Log ${{ inputs.changelog-path }} | ||
shell: bash | ||
run: cat ${{ inputs.changelog-path }} |
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,15 @@ | ||
name: Enforce PR labels | ||
|
||
on: | ||
pull_request: | ||
types: [labeled, unlabeled, opened, reopened, edited, synchronize] | ||
jobs: | ||
enforce-label: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: yogevbd/enforce-label-action@a3c219da6b8fa73f6ba62b68ff09c469b3a1c024 | ||
with: | ||
REQUIRED_LABELS_ANY: "Rust,Wasm,Documentation,No changelog" | ||
- uses: yogevbd/enforce-label-action@a3c219da6b8fa73f6ba62b68ff09c469b3a1c024 | ||
with: | ||
REQUIRED_LABELS_ANY: "Breaking change,Added,Patch,Deprecated,Removed,Documentation,No changelog" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,32 @@ | ||
name: Rust Automatic Release and Publish | ||
|
||
# Automatically creates a GitHub release and publishes the latest Rust crate versions to crates.io when a release PR is merged. | ||
on: | ||
pull_request: | ||
branches: | ||
- dev | ||
- main | ||
types: [closed] | ||
jobs: | ||
call-create-release-workflow: | ||
if: github.event.pull_request.merged == true | ||
# owner/repository of workflow has to be static, see https://github.community/t/env-variables-in-uses/17466 | ||
uses: iotaledger/identity.rs/.github/workflows/shared-release.yml@dev | ||
with: | ||
changelog-config-path: ./.github/.github_changelog_generator | ||
dev-tag-regex: ^v[0-9]+\.[0-9]+\.[0-9]+-(dev)\.\d*$ | ||
main-tag-regex: ^v[0-9]+\.[0-9]+\.[0-9]+$ | ||
create-github-release: true | ||
secrets: | ||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: call-create-release-workflow | ||
if: ${{ needs.call-create-release-workflow.outputs.is-release }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Dummy Publish to crates.io | ||
# TODO: implement proper publish | ||
run: echo beep boop, pretending to publish |
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,44 @@ | ||
name: Rust Create Release PR | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to release Rust under (e.g. `1.2.3`)' | ||
required: true | ||
release-type: | ||
description: Create a `dev` or `main` release. If `dev`, a `dev` postfix and auto-incrementing number will be added automatically (e.g. `1.2.3-dev.x`)' | ||
type: choice | ||
required: true | ||
options: | ||
- dev | ||
- main | ||
|
||
jobs: | ||
create-dev-release-pr: | ||
if: github.event.inputs.release-type == 'dev' | ||
# owner/repository of workflow has to be static, see https://github.community/t/env-variables-in-uses/17466 | ||
uses: iotaledger/identity.rs/.github/workflows/shared-create-dev-release-pr.yml@dev | ||
with: | ||
tag-prefix: v | ||
tag-postfix: -dev. | ||
tag-base: ${{ github.event.inputs.version }} | ||
main-tag-regex: ^v[0-9]+\.[0-9]+\.[0-9]+$ | ||
changelog-config-path: ./.github/.github_changelog_generator | ||
release-target: rust | ||
secrets: | ||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
create-main-release-pr: | ||
if: github.event.inputs.release-type == 'main' | ||
# owner/repository of workflow has to be static, see https://github.community/t/env-variables-in-uses/17466 | ||
uses: iotaledger/identity.rs/.github/workflows/shared-create-main-release-pr.yml@dev | ||
with: | ||
tag-prefix: v | ||
tag-base: ${{ github.event.inputs.version }} | ||
main-tag-regex: ^v[0-9]+\.[0-9]+\.[0-9]+$ | ||
changelog-config-path: ./.github/.github_changelog_generator | ||
release-target: rust | ||
secrets: | ||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
Oops, something went wrong.