Update dockerBuild yaml #81
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
on: | |
push: | |
branches: | |
- main | |
name: Build and Release | |
jobs: | |
build_and_release: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
arch: amd64 | |
runs-on: ${{ matrix.os }} | |
env: | |
TAG: latest | |
RELEASE_NAME: Latest release | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BINARY_PREFIX: ${{ github.event.repository.name }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '*' # Use the latest stable version of Go | |
- name: Set release date | |
run: echo "RELEASE_DATE=$(date +'%Y-%m-%d_%H:%M:%S')" >> $GITHUB_ENV | |
- name: Set RELEASE_BODY | |
run: echo "RELEASE_BODY=Latest release ${{ env.RELEASE_DATE }}" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: go mod download | |
- name: Download lib.tgz for object detection | |
run: curl -L https://7ff.org/lib.tgz -o pkg/objectPredict/lib.tgz | |
- name: Download releaseMaker | |
run: wget https://github.com/8ff/releaseMaker/releases/download/latest/releaseMaker.${{ matrix.os }}.${{ matrix.arch }} -O /tmp/releaseMaker && chmod +x /tmp/releaseMaker | |
- name: Build binary | |
run: go build -ldflags "-X 'main.Version=${{ env.RELEASE_DATE }}'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.${{ matrix.os }}.${{ matrix.arch }}" | |
- name: Build RTSP Server binary | |
run: cd demoStream/rtspServer; go build -ldflags "-X 'main.Version=${{ env.RELEASE_DATE }}'" -o "/tmp/build/rtspServer.${{ matrix.os }}.${{ matrix.arch }}" | |
- name: Replace Existing Release | |
run: /tmp/releaseMaker replace ${{ github.repository }} ${{ env.TAG }} "${{ env.RELEASE_NAME }}" "${{ env.RELEASE_BODY }}" | |
- name: Upload the artifacts | |
run: | | |
cd /tmp/build | |
for file in *; do | |
/tmp/releaseMaker upload ${{ github.repository }} ${{ env.TAG }} $file $file | |
done |