Skip to content

chore: fix release workflow #14

chore: fix release workflow

chore: fix release workflow #14

Workflow file for this run

name: release
permissions:
contents: write
on:
push:
tags:
- "v*.*.*"
env:
BIN_NAME: kubectl-resource_status
jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
release_version: ${{ github.ref_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Generate Release Notes
run: |
./.github/workflows/release-notes.py --tag ${{ github.ref_name }} --output notes-${{ github.ref_name }}.md
cat notes-${{ github.ref_name }}.md
- name: Create GitHub release
id: release
uses: softprops/action-gh-release@v1
with:
body_path: notes-${{ github.ref_name }}.md
build-release:
name: build-release
needs: create-release
strategy:
matrix:
build: [macos, macos-m1]
include:
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: macos-m1
os: macos-latest
rust: stable
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install packages (Ubuntu)
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends xz-utils liblz4-tool libssl-dev
- name: Install packages (mac)
if: matrix.os != 'ubuntu-20.04'
run: |
brew update
brew install [email protected]
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Build release binary
run: cargo build --target ${{ matrix.target }} --release
- name: Build archive
shell: bash
run: |
staging="${{ env.BIN_NAME }}-${{ needs.create-release.outputs.release_version }}-${{ matrix.target }}"
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}" "$staging/"
tar czf "$staging.tar.gz" -C "$staging" .
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
- name: Upload release archive
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.ASSET }}
homebrew-releaser:
runs-on: ubuntu-latest
needs: build-release
name: homebrew-releaser
steps:
- name: Release to Homebrew tap
uses: Justintime50/homebrew-releaser@v1
with:
homebrew_owner: nothinux
homebrew_tap: homebrew-tools
formula_folder: formula
github_token: ${{ secrets.TAP_TOKEN }}
install: 'bin.install "kubectl-resource_status"'
target_darwin_amd64: true
target_darwin_arm64: true
target_linux_amd64: true
target_linux_arm64: false
update_readme_table: true