Skip to content

Commit

Permalink
🚀 adjust build-package flow
Browse files Browse the repository at this point in the history
  • Loading branch information
anngdinh committed Jun 27, 2024
1 parent 01b9ce1 commit cac7ef3
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 40 deletions.
77 changes: 44 additions & 33 deletions .github/workflows/build-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,45 +35,56 @@ jobs:
- name: Clear build directory
run: rm -rf ./build/

- name: Build
run: NIGHTLY=vmonitor make package include_packages="freebsd_amd64.tar.gz linux_amd64.tar.gz amd64.deb x86_64.rpm"
# - name: Build
# run: NIGHTLY=vmonitor make package include_packages="freebsd_amd64.tar.gz linux_amd64.tar.gz amd64.deb x86_64.rpm"
# run: NIGHTLY=vmonitor make package include_packages="freebsd_amd64.tar.gz linux_amd64.tar.gz amd64.deb x86_64.rpm linux_arm64.tar.gz arm64.deb aarch64.rpm freebsd_i386.tar.gz i386.deb linux_i386.tar.gz i386.rpm"

# - name: Install Windows dependencies
# run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest && export PATH=~/go/bin
- name: Install Windows dependencies
run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest && export PATH=~/go/bin

# - name: Build Windows package
# run: NIGHTLY=vmonitor make package include_packages="windows_amd64.zip"
# # run: NIGHTLY=vmonitor make package include_packages="windows_i386.zip windows_amd64.zip windows_arm64.zip"
- name: Build Windows package
run: NIGHTLY=vmonitor make package include_packages="windows_amd64.zip"
# run: NIGHTLY=vmonitor make package include_packages="windows_i386.zip windows_amd64.zip windows_arm64.zip"

- name: Debug
run: ls -al ./build/dist/

- name: Upload files to a GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: for file in ./build/dist/*; do gh release upload "${{ github.ref_name }}" "$file" --repo="$GITHUB_REPOSITORY"; done
# - name: Upload files to a GitHub release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# tag: ${{ github.ref_name }}
# run: for file in ./build/dist/*; do gh release upload "${{ github.ref_name }}" "$file" --repo="$GITHUB_REPOSITORY"; done

# ############## build and upload image
# - name: Log in to the GHCR
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

############## build and upload image
- name: Log in to the GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# build-args: |
# ARG_VERSION=${{ github.ref_name }}
# ARG_GITHUB_REPOSITORY=${{ github.repository }}
# context: ./docker
# push: true
# tags: |
# ghcr.io/${{ github.repository_owner }}/telegraf:${{ github.ref_name }}
# ghcr.io/${{ github.repository_owner }}/telegraf:${{ github.sha }}
# # labels: ${{ steps.metadata.outputs.labels }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: |
VERSION=${{ github.ref_name }}
platforms: linux/amd64
outputs: type=registry
tags: |
ghcr.io/vngcloud/${{ matrix.image }}:${{ github.sha }}
${{ env.REPO }}/${{ matrix.image }}:${{ github.sha }}
${{ env.REPO }}/${{ matrix.image }}:${{ env.VERSION }}
target: ${{ matrix.image }}
# - name: Build and push Docker image Alpine
# uses: docker/build-push-action@v5
# with:
# build-args: |
# ARG_VERSION=${{ github.ref_name }}
# ARG_GITHUB_REPOSITORY=${{ github.repository }}
# context: ./docker/alpine
# push: true
# tags: |
# ghcr.io/${{ github.repository_owner }}/telegraf:${{ github.ref_name }}-alpine
# ghcr.io/${{ github.repository_owner }}/telegraf:${{ github.sha }}-alpine
# # labels: ${{ steps.metadata.outputs.labels }}
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,8 @@ config:
@echo "generating default config $(GOOS)"
# go run ./cmd/telegraf config > etc/telegraf.conf

rm -rf etc/telegraf.conf
cp -rf etc/telegraf_linux.conf etc/telegraf.conf

@if [ $(GOOS) = "windows" ]; then \
rm -rf etc/telegraf.conf \
cp -rf etc/telegraf_windows.conf etc/telegraf.conf; \
fi
@if [ $(GOOS) != "windows" ]; then cp -rf etc/telegraf_linux.conf etc/telegraf.conf; fi
@if [ $(GOOS) = "windows" ]; then cp -rf etc/telegraf_windows.conf etc/telegraf.conf; fi

.PHONY: docs
docs: build_tools embed_readme_inputs embed_readme_outputs embed_readme_processors embed_readme_aggregators embed_readme_secretstores
Expand Down

0 comments on commit cac7ef3

Please sign in to comment.