Merge pull request #6 from JuniorIsAJitterbug/main #2
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 binary" | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "misrc_extract-*" | |
env: | |
ARCHIVE_NAME_LINUX: ${{ github.ref_name }}-linux-x86_64.tar.gz | |
ARCHIVE_NAME_SRC: ${{ github.ref_name }}-src.tar.gz | |
jobs: | |
build-linux: | |
name: Build Linux | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: cmake nasm build-essential | |
version: 1.0 | |
- name: Build | |
run: | | |
cmake -B ${{ github.workspace }}/misrc_extract/build \ | |
${{ github.workspace }}/misrc_extract | |
cmake --build ${{ github.workspace }}/misrc_extract/build | |
- name: Create binary archive | |
run: >- | |
tar -cvzf ${{ env.ARCHIVE_NAME_LINUX }} | |
--owner=root --group=root | |
-C ${{ github.workspace }}/misrc_extract/build | |
misrc_extract | |
- name: Create source archive | |
run: >- | |
tar -cvzf ${{ env.ARCHIVE_NAME_SRC }} | |
--exclude=build | |
misrc_extract | |
- name: Upload binary artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: misrc_extract-linux | |
path: ${{ env.ARCHIVE_NAME_LINUX }} | |
if-no-files-found: error | |
- name: Upload source artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: misrc_extract-src | |
path: ${{ env.ARCHIVE_NAME_SRC }} | |
if-no-files-found: error | |
github-release: | |
name: Create GitHub release | |
runs-on: ubuntu-20.04 | |
needs: | |
- build-linux | |
permissions: | |
contents: write # IMPORTANT: mandatory for making GitHub Releases | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: >- | |
gh release create | |
'${{ github.ref_name }}' | |
--repo '${{ github.repository }}' | |
--title '${{ github.ref_name }}' | |
--notes "" | |
- name: Upload artifacts to GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
gh release upload \ | |
'${{ github.ref_name }}' \ | |
'misrc_extract-linux/${{ env.ARCHIVE_NAME_LINUX }}' \ | |
--repo '${{ github.repository }}' | |
gh release upload \ | |
'${{ github.ref_name }}' \ | |
'misrc_extract-src/${{ env.ARCHIVE_NAME_SRC }}' \ | |
--repo '${{ github.repository }}' |