-
Notifications
You must be signed in to change notification settings - Fork 2
165 lines (146 loc) · 6.14 KB
/
Copy pathrelease.yml
File metadata and controls
165 lines (146 loc) · 6.14 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Release
on:
push:
tags: ["v*"]
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- target: x86_64-apple-darwin
runner: macos-14
archive: tar.gz
- target: aarch64-apple-darwin
runner: macos-latest
archive: tar.gz
- target: x86_64-unknown-linux-musl
runner: ubuntu-latest
archive: tar.gz
- target: aarch64-unknown-linux-musl
runner: ubuntu-latest
archive: tar.gz
cross: true
- target: x86_64-pc-windows-msvc
runner: windows-latest
archive: zip
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
key: ${{ matrix.target }}
- name: Install musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Install cross
if: matrix.cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build (cross)
if: matrix.cross
run: cross build --release --target ${{ matrix.target }}
- name: Build (native)
if: "!matrix.cross"
run: cargo build --release --target ${{ matrix.target }}
- name: Package (unix)
if: matrix.archive == 'tar.gz'
run: |
package="teams-${{ github.ref_name }}-${{ matrix.target }}"
mkdir -p "dist/${package}/bin" "dist/${package}/share/doc" "dist/${package}/share/man/man1" "dist/${package}/share/man/man5" "dist/${package}/share/man/man7"
cp "target/${{ matrix.target }}/release/teams" "dist/${package}/bin/teams"
cp docs/man/teams.1 "dist/${package}/share/man/man1/teams.1"
cp docs/man/teams-config.5 "dist/${package}/share/man/man5/teams-config.5"
cp docs/man/teams-auth.7 "dist/${package}/share/man/man7/teams-auth.7"
cp docs/man/teams-agent-contract.7 "dist/${package}/share/man/man7/teams-agent-contract.7"
cp docs/man/teams-examples.7 "dist/${package}/share/man/man7/teams-examples.7"
cp -R docs "dist/${package}/share/doc/teams"
cp README.md CHANGELOG.md LICENSE SECURITY.md "dist/${package}/share/doc/teams/"
tar czf "${package}.tar.gz" -C dist "${package}"
- name: Package (windows)
if: matrix.archive == 'zip'
shell: pwsh
run: |
$package = "teams-${{ github.ref_name }}-${{ matrix.target }}"
New-Item -ItemType Directory -Force -Path "dist/$package/bin", "dist/$package/share/doc", "dist/$package/share/man/man1", "dist/$package/share/man/man5", "dist/$package/share/man/man7"
Copy-Item "target/${{ matrix.target }}/release/teams.exe" "dist/$package/bin/teams.exe"
Copy-Item "docs/man/teams.1" "dist/$package/share/man/man1/teams.1"
Copy-Item "docs/man/teams-config.5" "dist/$package/share/man/man5/teams-config.5"
Copy-Item "docs/man/teams-auth.7" "dist/$package/share/man/man7/teams-auth.7"
Copy-Item "docs/man/teams-agent-contract.7" "dist/$package/share/man/man7/teams-agent-contract.7"
Copy-Item "docs/man/teams-examples.7" "dist/$package/share/man/man7/teams-examples.7"
Copy-Item -Recurse "docs" "dist/$package/share/doc/teams"
Copy-Item -Path @("README.md", "CHANGELOG.md", "LICENSE", "SECURITY.md") -Destination "dist/$package/share/doc/teams/"
Compress-Archive -Path "dist/$package" -DestinationPath "$package.zip"
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: teams-${{ matrix.target }}
path: teams-${{ github.ref_name }}-${{ matrix.target }}.*
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: artifacts
merge-multiple: true
- name: Generate checksums
run: |
cd artifacts
sha256sum teams-* > checksums-sha256.txt
cat checksums-sha256.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
with:
generate_release_notes: true
files: |
artifacts/teams-*
artifacts/checksums-sha256.txt
homebrew:
name: Update Homebrew Tap
needs: release
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Update homebrew formula
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
with:
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
repository: osodevops/homebrew-tap
event-type: update-formula
client-payload: |
{
"formula": "teams-cli",
"tag": "${{ github.ref_name }}",
"repo": "${{ github.repository }}"
}
publish-scoop-manifest:
name: Publish Scoop Manifest
needs: release
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Trigger Scoop bucket update
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
with:
token: ${{ secrets.SCOOP_BUCKET_TOKEN }}
repository: osodevops/scoop-bucket
event-type: update-teams-manifest
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "tag": "${{ github.ref_name }}"}'