🚀 adjust build-package flow #3
Workflow file for this run
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
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_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: Log in to the vCR | |
uses: docker/login-action@v3 | |
with: | |
registry: vcr.vngcloud.vn | |
username: ${{ secrets.VCR_USER_PRO }} | |
password: ${{ secrets.VCR_PASSWORD_PRO }} | |
- 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 }} | |
vcr.vngcloud.vn/81-vmp-public/telegraf:${{ github.ref_name }} | |
vcr.vngcloud.vn/81-vmp-public/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 | |
vcr.vngcloud.vn/81-vmp-public/telegraf:${{ github.ref_name }}-alpine | |
vcr.vngcloud.vn/81-vmp-public/telegraf:${{ github.sha }}-alpine | |
# labels: ${{ steps.metadata.outputs.labels }} |