update yml #48
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: Create Artifact | |
on: | |
push: | |
branches: [release] | |
paths-ignore: | |
- "**/**.md" | |
jobs: | |
build-project: | |
strategy: | |
matrix: | |
GO_VERSION: [1.21] | |
OS_WINDOWS: [windows] | |
OS_LINUX: [linux] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.GO_VERSION }} | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up version | |
run: | | |
YEAR=$(date +'%Y') | |
MONTH=$(date +'%m') | |
DAY=$(date +'%d') | |
VERSION_TAG="${YEAR}.${MONTH}.${DAY}_${{ github.run_number }}" | |
echo "VERSION_TAG=${VERSION_TAG}" >> $GITHUB_ENV | |
- name: Install PCAP Compiler | |
run: | | |
sudo apt update | |
sudo apt install libpcap-dev -y | |
- name: Unit Test | |
run: | | |
cd ./src | |
ls -R | |
go test -v | |
- name: Build Windows Artifact | |
run: | | |
cd ./src | |
go mod tidy | |
GOOS=${{ matrix.OS_WINDOWS }} GOARCH=amd64 go build -o ./SwitchValidationTool_${{ env.VERSION_TAG }}/${{ matrix.OS_WINDOWS }}/ | |
- name: Build Linux Artifact | |
run: | | |
cd ./src | |
go mod tidy | |
GOOS=${{ matrix.OS_LINUX }} GOARCH=amd64 go build -o ./SwitchValidationTool_${{ env.VERSION_TAG }}/${{ matrix.OS_LINUX }}/ | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: SwitchValidationTool_${{ env.VERSION_TAG }} | |
path: ./src/SwitchValidationTool_${{ env.VERSION_TAG }}/ |