Skip to content

release

release #28

Workflow file for this run

name: release
on: workflow_dispatch
jobs:
build:
strategy:
matrix:
config:
- os: ubuntu
target: x86_64-unknown-linux-gnu
output: changelogging
- os: macos
target: x86_64-apple-darwin
output: changelogging
- os: macos
target: aarch64-apple-darwin
output: changelogging
- os: windows
target: x86_64-pc-windows-msvc
output: changelogging.exe
- os: windows
target: aarch64-pc-windows-msvc
output: changelogging.exe
runs-on: ${{ matrix.config.os }}-latest
env:
file: ${{ matrix.config.output }}
copy: target/release/${{ matrix.config.output }}
target: ${{ matrix.config.target }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.config.target }}
- name: Install cargo-get
run: cargo install cargo-get
- name: Get version
shell: bash
run: echo "version=$(cargo get package.version)" >> "$GITHUB_ENV"
- name: Get name
shell: bash
run: echo "name=changelogging-$version-$target" >> "$GITHUB_ENV"
- name: Build
run: cargo build --release
- name: Archive (ubuntu)
if: matrix.config.os == 'ubuntu'
run: |
cp ${{ env.copy }} ${{ env.file }}
tar -cvzf ${{ env.name }}.tar.gz ${{ env.file }}
- name: Archive (macos)
if: matrix.config.os == 'macos'
run: |
cp ${{ env.copy }} ${{ env.file }}
zip ${{ env.name }}.zip ${{ env.file }}
- name: Archive (windows)
if: matrix.config.os == 'windows'
run: |
copy ${{ env.copy }} ${{ env.file }}
7z a ${{ env.name }}.zip ${{ env.file }}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{ env.name }}
path: ${{ env.name }}.*
release:
needs: build
runs-on: ubuntu-latest
env:
archives: archives
name: nekit[bot]
email: [email protected]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download
uses: actions/download-artifact@v4
with:
path: ${{ env.archives }}
merge-multiple: true
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-get
run: cargo install cargo-get
- name: Get version
shell: bash
run: echo "version=$(cargo get package.version)" >> "$GITHUB_ENV"
- name: Get name
shell: bash
run: echo "changelog=CHANGELOG-$version.md" >> "$GITHUB_ENV"
- name: Get tag
shell: bash
run: echo "tag=v$version" >> "$GITHUB_ENV"
- name: Build changelog ${{ env.version }}
run: cargo run preview > ${{ env.changelog }}
- name: Build changelog
run: cargo run build --stage --remove
- name: Setup git user
run: |
git config --local user.name ${{ env.name }}
git config --local user.email ${{ env.email }}
- name: Fetch
run: git fetch
- name: Checkout
run: git checkout main
- name: Commit
run: git commit --message "Add ${{ env.version }} to the changelog."
- name: Tag
run: git tag ${{ env.tag }}
- name: Push
run: git push --set-upstream --atomic origin main ${{ env.tag }}
- name: Release
uses: softprops/action-gh-release@v2
with:
body_path: ${{ env.changelog }}
tag_name: ${{ env.tag }}
files: ${{ env.archives }}/*