Skip to content

Commit

Permalink
ci: prepare release oxlint
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Jun 6, 2024
1 parent 769227b commit 1e02144
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 55 deletions.
57 changes: 3 additions & 54 deletions .github/workflows/prepare_release_crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,6 @@ env:

jobs:
prepare_release:
name: Prepare Release Crates
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: Boshen/setup-rust@main
with:
cache-key: warm
tools: cargo-release-oxc

- name: Run
id: run
run: |
{
echo 'OUTPUT<<EOF'
cargo release-oxc update --release crates
echo EOF
} >> $GITHUB_OUTPUT
- name: Save Version
id: version
run: |
{
echo 'VERSION<<EOF'
echo '${{ steps.run.outputs.OUTPUT }}' | tail -n 1
echo EOF
} >> $GITHUB_OUTPUT
- name: Save Changelog
id: changelog
run: |
{
echo 'CHANGELOG<<EOF'
echo '${{ steps.run.outputs.OUTPUT }}' | head -n -1
echo EOF
} >> $GITHUB_OUTPUT
# update `Cargo.lock`
- run: cargo check

- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Release crates
committer: Boshen <Boshen@users.noreply.github.com>
author: Boshen <Boshen@users.noreply.github.com>
branch: release/crates
branch-suffix: timestamp
title: Release crates v${{ steps.version.outputs.VERSION }}
body: ${{ steps.changelog.outputs.CHANGELOG }}
assignees: Boshen
reviewers: Boshen
uses: ./.github/workflows/reusable_prepare_release.yml
with:
name: crates
25 changes: 25 additions & 0 deletions .github/workflows/prepare_release_oxlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Prepare Release Oxlint

on:
workflow_dispatch:
push:
branches:
- prepare-release-oxlint

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
pull-requests: write
contents: write

env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-D warnings"

jobs:
prepare_release:
uses: ./.github/workflows/reusable_prepare_release.yml
with:
name: oxlint
67 changes: 67 additions & 0 deletions .github/workflows/reusable_prepare_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Prepare Release

on:
workflow_call:
inputs:
name:
required: true
type: string
description: "The name defined in oxc_release.toml"

jobs:
run:
name: Prepare Release Crates
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: Boshen/setup-rust@main
with:
cache-key: warm
tools: cargo-release-oxc

- name: Run
id: run
run: |
{
echo 'OUTPUT<<EOF'
cargo release-oxc update --release ${{ inputs.name }}
echo EOF
} >> $GITHUB_OUTPUT
- name: Save Version
id: version
run: |
{
echo 'VERSION<<EOF'
# Last line is the version
echo '${{ steps.run.outputs.OUTPUT }}' | tail -n 1
echo EOF
} >> $GITHUB_OUTPUT
- name: Save Changelog
id: changelog
run: |
{
echo 'CHANGELOG<<EOF'
# Remove the last line
echo '${{ steps.run.outputs.OUTPUT }}' | head -n -1
echo EOF
} >> $GITHUB_OUTPUT
# update `Cargo.lock`
- run: cargo check

- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Release ${{ inputs.name }}
committer: Boshen <Boshen@users.noreply.github.com>
author: Boshen <Boshen@users.noreply.github.com>
branch: release/${{ inputs.name }}
branch-suffix: timestamp
title: Release ${{ inputs.name }} v${{ steps.version.outputs.VERSION }}
body: ${{ steps.changelog.outputs.CHANGELOG }}
assignees: Boshen
2 changes: 1 addition & 1 deletion cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ body = """
- {{ commit.message | trim }} |
{%- endif -%}
{%- endfor %}
{% endfor %}\n
{% endfor %}
"""
# remove the leading and trailing whitespace from the templates
trim = true
Expand Down

0 comments on commit 1e02144

Please sign in to comment.