-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
committed
Mar 27, 2023
1 parent
56cdf84
commit e784118
Showing
7 changed files
with
195 additions
and
24 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Hades-agent | ||
|
||
on: | ||
push: | ||
tags: | ||
- agent-v* | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: go env | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.20' | ||
|
||
- name: make env | ||
run: | | ||
sudo apt-get install make | ||
shell: bash | ||
|
||
- name: build version | ||
run: | ||
TAG = ${{ github.ref }} | ||
BUILD_VERSION=$(echo TAG | sed 's/agent-//') | ||
echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_ENV | ||
|
||
- name: auth | ||
run: | | ||
gh auth login --with-token <<<'${{ secrets.GITHUB_TOKEN }}' | ||
- name: build | ||
run: | | ||
cd agent/deploy | ||
BUILD_VERSION=${{ env.BUILD_VERSION }} sh build.sh | ||
cd ../.. | ||
- name: upload | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: /tmp/hades-agent-* | ||
name: hades-agent | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
steps: | ||
- name: create release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
# draft for testing! | ||
draft: true | ||
prerelease: false | ||
release_name: Release ${{github.ref}} | ||
tag_name: ${{github.ref}} | ||
- name: version env | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
path: /tmp/hades-agent | ||
- name: release | ||
uses: actions/checkout@v2 | ||
run: | | ||
for asset in /tmp/hades-agent/; do | ||
hub release create ${asset} | ||
echo ${asset} | ||
done | ||
needs: | ||
- build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Hades-collector | ||
|
||
on: | ||
push: | ||
tags: | ||
- collector-v* | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: go env | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.19' | ||
|
||
- name: auth | ||
run: | | ||
gh auth login --with-token <<<'${{ secrets.GITHUB_TOKEN }}' | ||
- name: build | ||
run: | | ||
cd plugins/collector | ||
make | ||
cd ../.. | ||
- name: upload | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: plugins/collector/collector | ||
name: collector | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
steps: | ||
- name: create release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
# draft for testing! | ||
draft: true | ||
prerelease: false | ||
release_name: Release ${{github.ref}} | ||
tag_name: ${{github.ref}} | ||
- name: version env | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
path: /tmp/collector | ||
- name: package | ||
working-directory: /tmp/collector/collector | ||
run: | | ||
sha256sum collector >> checksum.txt | ||
tar zcvf /tmp/collector.tgz collector checksum.txt | ||
- name: upload | ||
id: upload | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
with: | ||
asset_content_type: application/tar+gzip | ||
asset_name: ${{ env.RELEASE_VERSION }}.tgz | ||
asset_path: /tmp/collector.tgz | ||
upload_url: ${{steps.create_release.outputs.upload_url}} | ||
needs: | ||
- build |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# install nfpm | ||
if ! nfpm -v > /dev/null 2>&1;then | ||
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest | ||
fi | ||
|
||
# release both arch | ||
for arch in amd64 arm64; do | ||
export GOARCH=${arch} | ||
sed -i 's/version:.*$/version: '${BUILD_VERSION}'/g' nfpm.yaml | ||
sed -i 's/arch:.*$/arch: '${arch}'/g' nfpm.yaml | ||
make deb | ||
make rpm | ||
done |
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
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
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