-
Notifications
You must be signed in to change notification settings - Fork 2
106 lines (105 loc) · 3.22 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: release
permissions:
contents: write
on:
push:
tags:
- "v*.*.*"
env:
BIN_NAME: kubectl-resource_status
RELEASE_NAME: kube-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: [darwin-amd64, darwin-arm64, linux-amd64]
include:
- build: darwin-amd64
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: darwin-arm64
os: macos-latest
rust: stable
target: aarch64-apple-darwin
- build: linux-amd64
os: ubuntu-20.04
rust: stable
target: x86_64-unknown-linux-musl
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 musl-tools
- 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: |
BIN_VER=$(echo "${{ needs.create-release.outputs.release_version }}" | sed 's/v//g')
bin_dir="${{ env.RELEASE_NAME }}-$BIN_VER-${{ matrix.build }}"
mkdir -p "$bin_dir"
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}" "$bin_dir/"
tar czf "$bin_dir.tar.gz" -C "$bin_dir" .
echo "ASSET=$bin_dir.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
commit_owner: homebrew-releaser
commit_email: [email protected]
github_token: ${{ secrets.TAP_TOKEN }}
install: 'bin.install "kubectl-resource_status"'
download_strategy: CurlDownloadStrategy
target_darwin_amd64: true
target_darwin_arm64: true
target_linux_amd64: true
target_linux_arm64: false
update_readme_table: true