Skip to content

🚀 adjust build-package flow #2

🚀 adjust build-package flow

🚀 adjust build-package flow #2

Workflow file for this run

name: Build and Release package
on:
push:
# Pattern matched against refs/tags
tags:
- "**" # Push events to every tag including hierarchical tags like v1.0/beta
jobs:
create_release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "${{ github.ref_name }}" \
--repo="$GITHUB_REPOSITORY" \
--title="${{ github.ref_name }}" \
--generate-notes
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Install dependencies
run: sudo apt -y install rubygems && sudo gem install fpm && sudo apt install binutils && sudo apt-get install rpm -y
- 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"
# 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: 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
############## 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 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 }}