💚 fix: build and release #10
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 | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, fedora-latest, centos-latest] | ||
include: | ||
- os: ubuntu-latest | ||
install: sudo apt-get update && sudo apt-get install -y libboost-all-dev clang | ||
- os: windows-latest | ||
install: | | ||
choco install llvm | ||
curl -L -o boost.zip https://storage.cmr.dev.br/boost.zip | ||
unzip boost.zip -d boost | ||
- os: fedora-latest | ||
install: sudo dnf install -y clang boost-devel | ||
- os: centos-latest | ||
install: sudo yum install -y clang boost-devel | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set up Clang | ||
if: matrix.os == 'windows-latest' | ||
uses: egor-tensin/setup-clang@v1 | ||
- name: Install dependencies | ||
run: ${{ matrix.install }} | ||
- name: Build - Windows | ||
if: matrix.os == 'windows-latest' | ||
run: clang++ -o cmr_cache.exe main.cpp -I./vendor/yaml -I./boost/ -L./boost/lib -llibboost_system-vc143-mt-x64-1_85 -std=c++17 | ||
- name: Build - Others OS | ||
if: matrix.os != 'windows-latest' | ||
run: clang++ -o cmr_cache main.cpp -I./vendor/yaml -lboost_system -lpthread -std=c++17 | ||
- name: Create Release Archive - Windows | ||
if: matrix.os != 'windows-latest' | ||
run: | | ||
mkdir -p release | ||
cp cmr_cache.exe release/ | ||
cp -r config/ release/ | ||
cp -r data/ release/ | ||
tar -czf cmr_cache_${{ matrix.os }}.tar.gz release | ||
- name: Get the tag | ||
run: echo "GITHUB_REF=${{ github.ref }}" | ||
- name: Extract the tag name | ||
id: extract_tag | ||
run: echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV | ||
- name: Create GitHub Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ env.TAG_NAME }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create Release Archive - Others OS | ||
if: matrix.os != 'windows-latest' | ||
run: | | ||
mkdir -p release | ||
cp cmr_cache release/ | ||
cp -r config/ release/ | ||
cp -r data/ release/ | ||
tar -czf cmr_cache_${{ matrix.os }}-${{ env.TAG_NAME }}.tar.gz release | ||
- name: Create GitHub Release | ||
id: create_release | ||
Check failure on line 81 in .github/workflows/build-and-release.yml GitHub Actions / Build and ReleaseInvalid workflow file
|
||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ env.TAG_NAME }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: cmr_cache_${{ matrix.os }}-${{ env.TAG_NAME }}.tar.gz | ||
asset_name: cmr_cache_${{ matrix.os }}-${{ env.TAG_NAME }}.tar.gz | ||
asset_content_type: application/gzip |