But for real this time #13
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, Test, Draft Release | |
on: | |
push: | |
branches: [ master ] | |
permissions: | |
contents: write | |
env: | |
cache-path: build/lib | |
artifacts-path: build/artifacts | |
release-build-content-type: application/owl | |
cache-key: build-cache-dependencies | |
jobs: | |
ontology_release: | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it. | |
- uses: actions/checkout@v3 | |
- name: Restore cached dependencies | |
id: restore-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.cache-path }} | |
# TODO this should be a file with a list of dependencies, to check if it changes and retrigger the cache | |
#key: ${{ env-cache-key}}-${{ hashFiles('**/package-lock.json') }} | |
key: ${{ runner.os }}-${{ env.cache-key }} | |
- name: List directory contents | |
run: ls -la /home/runner/work/BFO-2020 | |
- name: Build and test ontology release | |
run: make all | |
# working-directory: /home/runner/work/BFO-2020 | |
# Run the main steps here | |
- name: Build and test ontology release | |
id: build_release | |
run: | | |
make -d all | |
echo "RELEASE_FILE_PATH=$(make output-release-filepath)" >> $GITHUB_OUTPUT | |
echo "RELEASE_NAME=$(make output-release-name)" >> $GITHUB_OUTPUT | |
# Save any artifact files produced even if tests fail | |
- name: Save artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: ontology_release_results | |
path: ${{ env.artifacts-path }} | |
# Save cache even if tests fail and only if a cache wasn't restored | |
- name: Save dependencies to cache | |
id: save-cache | |
uses: actions/cache/save@v3 | |
if: always() && steps.restore-cache.outputs.cache-hit != 'true' | |
with: | |
path: ${{ env.cache-path }} | |
key: ${{ runner.os }}-${{ env.cache-key }} | |
# Draft a Github Release of the release build | |
- name: Draft Github Release | |
uses: actions/create-release@v1 | |
id: draft_release | |
with: | |
draft: true | |
prerelease: false | |
release_name: ${{ steps.build_release.outputs.RELEASE_NAME }} | |
tag_name: ${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-action-id | |
# body_path: CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Upload Github release build | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.draft_release.outputs.upload_url }} | |
asset_path: ${{ steps.build_release.outputs.RELEASE_FILE_PATH }} | |
asset_name: ${{ steps.build_release.outputs.RELEASE_FILE_PATH }} | |
asset_content_type: ${{env.release-build-content-type}} |