aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorLaurence Kedward <laurence.kedward@bristol.ac.uk>2020-11-25 16:00:58 +0000
committerGitHub <noreply@github.com>2020-11-25 16:00:58 +0000
commit105644ca8bce711b407e1a15f8f456693f60ff43 (patch)
tree2830f8c258b33dd237ad1f05e4d4c7475de45889 /.github/workflows
parent2612d9aea9db8802042516ca97e6eb7268da200d (diff)
parent846d4e50fd5e9c6fe7538409d9f4ae3722d0eca7 (diff)
downloadfpm-105644ca8bce711b407e1a15f8f456693f60ff43.tar.gz
fpm-105644ca8bce711b407e1a15f8f456693f60ff43.zip
Merge pull request #246 from LKedward/release_builds
CI: upload binaries when a release is published
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/CI.yml49
1 files changed, 48 insertions, 1 deletions
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 03fcf84..8165ded 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -1,6 +1,10 @@
name: CI
-on: [push, pull_request]
+on:
+ push:
+ pull_request:
+ release:
+ types: [published]
env:
CI: "ON" # We can detect this in the build system and other vendors implement it
@@ -23,16 +27,33 @@ jobs:
- os: ubuntu-latest
STACK_CACHE: "/home/runner/.stack/"
STACK_CACHE_VERSION: ""
+ GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
+ CHECK_VERSION_CMD: grep $(cat fpm_version)
+ RELEASE_CMD: "fpm run --flag --static --flag -g --flag -fbacktrace --flag -O3 --runner cp -- fpm-v$(cat fpm_version)-linux-x86_64"
+ BOOTSTRAP_RELEASE_CMD: cp /home/runner/.local/bin/fpm fpm-bootstrap-v$(cat fpm_version)-linux-x86_64
+ HASH_CMD: ls fpm-*|xargs -i{} sh -c 'sha256sum $1 > $1.sha256' -- {}
+
- os: macos-latest
STACK_CACHE: |
/Users/runner/.stack/snapshots
/Users/runner/.stack/setup-exe-src
STACK_CACHE_VERSION: "v2"
+ GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
+ CHECK_VERSION_CMD: grep $(cat fpm_version)
+ RELEASE_CMD: "fpm run --flag -g --flag -fbacktrace --flag -O3 --runner cp -- fpm-v$(cat fpm_version)-macos-x86_64"
+ BOOTSTRAP_RELEASE_CMD: cp /Users/runner/.local/bin/fpm fpm-bootstrap-v$(cat fpm_version)-macos-x86_64
+ HASH_CMD: ls fpm-*|xargs -I{} sh -c 'shasum -a 256 $1 > $1.sha256' -- {}
+
- os: windows-latest
STACK_CACHE: |
C:\Users\runneradmin\AppData\Roaming\stack
C:\Users\runneradmin\AppData\Local\Programs\stack
STACK_CACHE_VERSION: "v2"
+ GET_VERSION_CMD: ("${{ github.ref }}" -Split "v")[1]
+ CHECK_VERSION_CMD: Select-String -Pattern Version | Where-Object { if ($_ -like -join("*",(Get-Content fpm_version),"*")) {echo $_} else {Throw} }
+ RELEASE_CMD: fpm run --flag --static --flag -g --flag -fbacktrace --flag -O3 --runner copy -- (-join("fpm-v",(Get-Content fpm_version),"-windows-x86_64.exe"))
+ BOOTSTRAP_RELEASE_CMD: copy C:\Users\runneradmin\AppData\Roaming\local\bin\fpm.exe (-join("fpm-bootstrap-v",(Get-Content fpm_version),"-windows-x86_64.exe"))
+ HASH_CMD: Get-ChildItem -File -Filter "fpm-*" | Foreach-Object {echo (Get-FileHash -Algorithm SHA256 $PSItem | Select-Object hash | Format-Table -HideTableHeaders | Out-String) > (-join($PSItem,".sha256"))}
env:
FC: gfortran
@@ -104,3 +125,29 @@ jobs:
if: contains(matrix.os, 'windows')
run: |
ci\run_tests.bat
+
+ # ----- Upload binaries if creating a release -----
+ - name: Check that fpm --version matches release tag
+ if: github.event_name == 'release'
+ run: |
+ cd fpm
+ ${{ matrix.GET_VERSION_CMD }} > fpm_version
+ fpm run -- "--version" | ${{ matrix.CHECK_VERSION_CMD }}
+
+ - name: Stage release files for upload
+ if: github.event_name == 'release'
+ run: |
+ cd fpm
+ ${{ matrix.RELEASE_CMD }}
+ ${{ matrix.BOOTSTRAP_RELEASE_CMD }}
+ ${{ matrix.HASH_CMD }}
+
+ - name: Upload assets
+ if: github.event_name == 'release'
+ uses: svenstaro/upload-release-action@v2
+ with:
+ repo_token: ${{ secrets.GITHUB_TOKEN }}
+ file: fpm/fpm-*
+ file_glob: true
+ tag: ${{ github.ref }}
+ overwrite: true \ No newline at end of file