Skip to content

Next Version

Next Version #305

Workflow file for this run

name: Build and zip windows/linux
on:
workflow_dispatch:
push:
tags:
- tc_nightly
- tc_v*
pull_request:
branches: [ "master", "develop" ]
jobs:
build-windows-amd64:
runs-on: windows-latest
outputs:
upload_url: ${{ steps.set_data1.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Build windows
id: build-zip
run: cmd /c "C:\"Program Files"\"Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat && make build PLATFORM=windows SHELL_ENV=bash"
shell: cmd
- name: Check windows executable existence
id: check_release
uses: andstor/file-existence-action@v1
with:
files: "bin/teddycloud.exe"
allow_failure: true
- name: File exist
if: steps.check_files.outputs.files_exists == 'true'
run: echo windows release zip exists!
- uses: actions/upload-artifact@master
with:
name: windows-exe
path: bin\*
build-linux-amd64:
needs: build-windows-amd64
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.set_data1.outputs.upload_url }}
appendix: ${{ steps.set_data2.outputs.appendix }}
steps:
- name: Install build dependencies
run: sudo apt-get install -y --no-install-recommends gcc protobuf-c-compiler build-essential
- name: Get current datetime
id: get-datetime
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Set templates for nightly
id: set-templates-nightly
if: startsWith(github.ref, 'refs/tags/tc_nightly')
run: |
echo "TAG_NAME=${GITHUB_REF#refs/tags/}_${{ env.CURRENT_DATE }}_${{ github.run_number }}" >> $GITHUB_ENV
echo "RELEASE_NAME=Nightly ${{ env.CURRENT_DATE }} - Run ID ${{ github.run_number }}" >> $GITHUB_ENV
echo "ASSET_APPENDIX=nightly_${{ env.CURRENT_DATE }}.${{ github.run_number }}" >> $GITHUB_ENV
echo "IS_PRERELEASE=true" >> $GITHUB_ENV
- name: Set templates for release and delete trigger tag
id: set-templates-release
if: startsWith(github.ref, 'refs/tags/tc_v')
run: |
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "RELEASE_NAME=Release ${GITHUB_REF#refs/tags/tc_}" >> $GITHUB_ENV
echo "ASSET_APPENDIX=release_${GITHUB_REF#refs/tags/tc_}" >> $GITHUB_ENV
echo "IS_PRERELEASE=false" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/download-artifact@master
with:
name: windows-exe
path: ./bin/
- name: Build and zip amd64
id: build-zip
run: make zip
- name: Check amd64 release zip existence
id: check_release
uses: andstor/file-existence-action@v1
with:
files: "./install/zip/release.zip"
allow_failure: true
- name: File exist
if: steps.check_files.outputs.files_exists == 'true'
run: echo amd64 release zip exists!
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: TeddyCloud ${{ env.RELEASE_NAME }}
draft: true
prerelease: ${{ env.IS_PRERELEASE }}
if: github.event_name != 'pull_request'
- uses: actions/upload-artifact@master
with:
name: release.zip
path: ./install/zip/release.zip
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./install/zip/release.zip
asset_name: teddycloud.amd64.${{ env.ASSET_APPENDIX }}.zip
asset_content_type: application/zip
if: github.event_name != 'pull_request'
- id: set_data1
run: echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> "$GITHUB_OUTPUT"
if: github.event_name != 'pull_request'
- id: set_data2
run: echo "appendix=${{ env.ASSET_APPENDIX }}" >> "$GITHUB_OUTPUT"
if: github.event_name != 'pull_request'