Skip to content

Commit

Permalink
💚 fix: build and release
Browse files Browse the repository at this point in the history
  • Loading branch information
camargo2019 committed Sep 10, 2024
1 parent a7509a0 commit fac774c
Showing 1 changed file with 46 additions and 12 deletions.
58 changes: 46 additions & 12 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,60 @@ jobs:
- name: Install dependencies
run: ${{ matrix.install }}

- name: Build Windows
- 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
- 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

- name: Create Release Archive - Windows
if: matrix.os != 'windows-latest'
run: |
mkdir -p release
if [ "${{ matrix.os }}" == "windows-latest" ]; then
cp cmr_cache.exe release/
else
cp cmr_cache release/
fi
cp cmr_cache.exe release/
cp -r config/ release/
cp -r data/ release/
tar -czf cmr_cache_${{ matrix.os }}.tar.gz release
- name: Upload Release Archive
uses: actions/upload-artifact@v3
- 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
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:
name: cmr_cache_${{ matrix.os }}
path: cmr_cache_${{ matrix.os }}.tar.gz
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

0 comments on commit fac774c

Please sign in to comment.