Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
ci(C): auto build and release
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgramRipper committed Dec 15, 2022
1 parent 5e26d52 commit f6ad206
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/c.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: C

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

env:
BUILD_TYPE: Release

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3

- name: Configure CMake
run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}

- name: Build
run: cmake --build ${{ github.workspace }}/build --config ${{ env.BUILD_TYPE }}

- name: Rename
run: >
mv
${{ github.workspace }}/build/${{ matrix.os == 'windows-latest' && format('{0}/crack.exe', env.BUILD_TYPE) || 'crack' }}
${{ github.workspace }}/build/${{ matrix.os }}-crack${{ matrix.os == 'windows-latest' && '.exe' || '' }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-artifact
path: ${{ github.workspace }}/build/${{ matrix.os }}-crack${{ matrix.os == 'windows-latest' && '.exe' || '' }}

release:
if: github.event_name == 'push'

needs: build

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Download artifact
uses: actions/download-artifact@v2
with:
path: ${{ github.workspace }}/build

- name: Tag
id: tag
run: |
tag=$(git log -n1 --format="%h")
git config --local user.email "[email protected]"
git config --local user.name "ProgramRipper"
git tag -a $tag -m $tag
git push --tags
echo tag=$tag >> $GITHUB_OUTPUT
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.tag.outputs.tag }}
files: ${{ github.workspace }}/build/*-artifact/*

0 comments on commit f6ad206

Please sign in to comment.