Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BobanSpasic committed Nov 12, 2023
2 parents 7c799fd + 523637a commit 7d316b7
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Release

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-20.04

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Install dependencies and build
run: |
# A newer FreePascal compiler is needed than what ships with Ubuntu 20.04
wget -q "https://downloads.sourceforge.net/project/freepascal/Linux/3.2.2/fpc-3.2.2.x86_64-linux.tar"
tar xfv fpc-3.2.2.x86_64-linux.tar
cd fpc-*-linux
echo -e '/usr\nN\nN\nN\n' | sudo bash ./install.sh
cd ..
mkdir -p lib/x86_64-linux/ bin/Linux/
bash -ex compile.sh
shell: bash

- name: Upload binary to artifacts
uses: actions/upload-artifact@v2
with:
name: mdx_perfconv
path: bin/Linux/MDX_PerfConv

- name: Cleanup Old Releases
if: github.ref == 'refs/heads/main'
run: |
old_release_id=$(curl -s -H "Authorization: Bearer ${{secrets.GITHUB_TOKEN}}" "https://api.github.com/repos/${{github.repository}}/releases" | jq -r '.[] | select(.tag_name == "continuous") | .id')
if [[ -n "$old_release_id" ]]; then
echo "Deleting old release..."
curl -X DELETE -H "Authorization: Bearer ${{secrets.GITHUB_TOKEN}}" "https://api.github.com/repos/${{github.repository}}/releases/$old_release_id"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create or Update Release
if: github.ref == 'refs/heads/main'
id: create_release
uses: softprops/action-gh-release@v1
with:
files: bin/Linux/MDX_PerfConv
tag_name: continuous
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 7d316b7

Please sign in to comment.