v0.1.0 #1
Workflow file for this run
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
name: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
env: | |
PROJECT_NAME: islam | |
jobs: | |
create-github-release: | |
name: Create GitHub Release | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# it is a must! | |
fetch-depth: 0 | |
- name: Set the release version | |
shell: bash | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV | |
echo ${{ env.RELEASE_VERSION }} | |
- name: Checkout current tag | |
shell: bash | |
run: | | |
git checkout v${{ env.RELEASE_VERSION }} | |
- name: Generate a changelog | |
uses: orhun/git-cliff-action@v2 | |
id: git-cliff | |
with: | |
config: configs/cliff.toml | |
args: -vv --strip header --current | |
env: | |
OUTPUT: CHANGELOG.md.tmp | |
- name: Print the changelog | |
run: cat "${{ steps.git-cliff.outputs.changelog }}" | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
name: "v${{ env.RELEASE_VERSION }}" | |
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | |
generate_release_notes: true | |
body_path: "${{ steps.git-cliff.outputs.changelog }}" | |
publish: | |
name: Publish | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Set the release version | |
shell: bash | |
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV | |
- name: Show release version | |
shell: bash | |
run: | | |
echo ${{ env.RELEASE_VERSION }} | |
- name: Extract crate information | |
shell: bash | |
run: | | |
echo "PROJECT_NAME=${{ env.PROJECT_NAME }}" >> $GITHUB_ENV | |
- name: Install rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
- name: Create tarball | |
id: package | |
run: | | |
PKG_suffix=".tar.gz" | |
PKG_BASENAME=${PROJECT_NAME}-${RELEASE_VERSION} | |
PKG_NAME=${PKG_BASENAME}${PKG_suffix} | |
echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT | |
PKG_STAGING="/tmp/package" | |
ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/" | |
mkdir -p "${ARCHIVE_DIR}" | |
# Source | |
cp -r "src" "$ARCHIVE_DIR" | |
# README, LICENSE and CHANGELOG files | |
cp "README.md" "LICENSE" "CHANGELOG.md" "$ARCHIVE_DIR" | |
# Compress | |
pushd "${PKG_STAGING}/" >/dev/null | |
tar czf "${PKG_NAME}" "${PKG_BASENAME}"/ | |
popd >/dev/null | |
# Let subsequent steps know where to find the compressed package | |
echo "PKG_PATH=${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUT | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
name: "v${{ env.RELEASE_VERSION }}" | |
files: ${{ steps.package.outputs.PKG_NAME }} | |
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | |
generate_release_notes: false |