Skip to content

Release

Release #67

Workflow file for this run

name: "Release"
permissions:
contents: "write"
on:
workflow_run:
workflows: ["Tag"]
types:
- "completed"
jobs:
# always generate changelog, using 'unreleased' if the tag was not set
changelog:
name: Generate changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@v3
id: git-cliff
with:
config: cliff.toml
args: --verbose
env:
OUTPUT: CHANGELOG.md
- name: Print the changelog
run: cat "${{ steps.git-cliff.outputs.changelog }}"
- name: write changelog to repo
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update CHANGELOG
# run below only if the tag was set (incremented in Cargo.toml)
get-tag:
name: "Get Tag From Package Version"
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: "ubuntu-latest"
outputs:
pkg-version: ${{ steps.pkg-version.outputs.PKG_VERSION }}
steps:
- name: "Check out the repo"
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: "Get tag"
id: "pkg-version"
shell: "bash"
run: |
echo PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml) >> $GITHUB_OUTPUT
create-release:
name: "Create release"
needs:
- "get-tag"
- "changelog"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: actions/checkout@v4
with:
# include the commit with changelog
fetch-depth: 2
- name: "Create release"
uses: "taiki-e/create-gh-release-action@v1"
with:
branch: "main"
ref: refs/tags/v${{ needs.get-tag.outputs.pkg-version }}
token: ${{ secrets.GITHUB_TOKEN }}
upload-assets:
name: "Upload assets to Github releases"
needs:
- "get-tag"
- "create-release"
strategy:
matrix:
include:
- target: "aarch64-apple-darwin"
os: "macos-13"
- target: "x86_64-unknown-linux-gnu"
os: "ubuntu-latest"
- target: "x86_64-apple-darwin"
os: "macos-13"
# - target: "x86_64-pc-windows-msvc"
# os: "windows-latest"
runs-on: ${{ matrix.os }}
steps:
- name: "Check out the repo"
uses: actions/checkout@v4
- name: "Upload Binaries"
uses: "taiki-e/upload-rust-binary-action@v1"
with:
bin: "webex-tui"
target: ${{ matrix.target }}
archive: $bin-${{ matrix.target }}
ref: refs/tags/v${{ needs.get-tag.outputs.pkg-version }}
token: ${{ secrets.GITHUB_TOKEN }}
update-homebrew:
name: "Update homebrew formula"
needs:
# - "upload-assets" # use this when using the binary in brew
- "get-tag"
- "create-release"
runs-on: "ubuntu-latest"
steps:
- name: Bump homebrew formula
uses: dawidd6/action-homebrew-bump-formula@v3
with:
# custom GitHub access token with the 'public_repo' and 'workflow' scopes
token: ${{ secrets.WORKFLOW_AND_PUBLIC_REPO_TOKEN }}
tap: sgrimee/tap
formula: webex-tui
tag: ${{ needs.get-tag.outputs.pkg-version }}