Skip to content

doc: Update README

doc: Update README #13

Workflow file for this run

name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
changelog: ${{ steps.changelog.outputs.changelog }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from tag
id: get_version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Generate changelog
uses: orhun/git-cliff-action@v2
with:
config: cliff.toml
args: --latest --strip header
- name: Read changelog
id: changelog
run: |
echo "changelog<<EOF" >> $GITHUB_OUTPUT
cat git-cliff/CHANGELOG.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
build-release:
needs: create-release
strategy:
matrix:
include:
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
binary_name: dc
asset_name: decent-cloud-linux-amd64
- os: macos-latest
target: aarch64-apple-darwin
binary_name: dc
asset_name: decent-cloud-darwin-arm64
- os: ubuntu-20.04
target: x86_64-pc-windows-gnu
binary_name: dc.exe
asset_name: decent-cloud-windows-amd64.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'x86_64-pc-windows-gnu'
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64
- name: Build Release Binary
run: |
if [ "${{ matrix.target }}" = "x86_64-pc-windows-gnu" ]; then
cargo install cross --git https://github.com/cross-rs/cross
cross build --release --target ${{ matrix.target }} --bin dc
else
cargo build --release --target ${{ matrix.target }} --bin dc
fi
- name: Prepare binary
run: |
if [ "${{ matrix.target }}" = "x86_64-pc-windows-gnu" ]; then
cp target/${{ matrix.target }}/release/${{ matrix.binary_name }} ${{ matrix.asset_name }}
else
cp target/${{ matrix.target }}/release/${{ matrix.binary_name }} ${{ matrix.asset_name }}
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release ${{ github.ref_name }}
body: |
## Changelog
${{ needs.create-release.outputs.changelog }}
files: |
${{ matrix.asset_name }}
draft: false
prerelease: false
update-version:
needs: [create-release, build-release]
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Update version in Cargo.toml files
run: |
VERSION="${{ needs.create-release.outputs.version }}"
for toml in $(find . -name "Cargo.toml"); do
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" "$toml"
done
timeout 10 cargo check || true
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
# Use PAT instead of GITHUB_TOKEN for PR creation to avoid error
# Error: GitHub Actions is not permitted to create or approve pull requests.
token: ${{ secrets.DC_REPO_WRITE }}
commit-message: "chore: bump version to ${{ needs.create-release.outputs.version }}"
title: "chore: bump version to ${{ needs.create-release.outputs.version }}"
body: |
Updates version in Cargo.toml+lock files to match the latest release.
This PR was automatically created by the release workflow.
branch: bump-version-${{ needs.create-release.outputs.version }}
base: main