Merge pull request #10 from ThyMYthOS/usb_requests #62
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
on: # Run the workflow for each of the following event: | |
push: # - A branch is pushed or updated. | |
pull_request: # - A pull-request is openned or updated. | |
workflow_dispatch: # - A manual run of the workflow is requested from the GitHub web interface. | |
release: | |
types: [created] # - A release is created. | |
jobs: | |
main: | |
strategy: | |
fail-fast: false # Don't stop all the workflows when one of them fails. | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] # List of GitHuh Actions platform to run the workflow on | |
runs-on: ${{ matrix.os }} # Run the continous integration workflow on each OS listed in the matrix. | |
steps: | |
# Check-out the repository | |
- uses: actions/checkout@v2 | |
# Install and setup Alire package manager | |
- uses: alire-project/setup-alire@v1 | |
# Build the project using the validation build profile to enforce static analysis and coding style. | |
- run: alr build --validation | |
# Run the testsuite | |
- run: cd tests && alr -q run | |
# Produce an Alire release manifest | |
- name: Make Release Manifest | |
if: (github.event_name == 'release' || github.event_name == 'push') | |
run: | | |
# Set user GitHub login required for `alr publish` | |
alr config --set --global user.github_login ${{github.repository_owner}} | |
# Run Alire publish assistant | |
alr publish ${{github.server_url}}/${{github.repository}} ${{github.sha}} | |
# Save the path to the release manifest for the next step. | |
# This is a little trick to get around the fact that the actions/upload-release-asset doesn't allow globing pattern. | |
- name: Get Release Manifest PATH | |
if: (github.event_name == 'release' || github.event_name == 'push') | |
shell: bash | |
run: | | |
export MANIFEST_PATHNAME=$(ls alire/releases/*.toml | head -n 1) | |
echo MANIFEST_PATHNAME=$MANIFEST_PATHNAME >> $GITHUB_ENV | |
echo MANIFEST_NAME=$(basename $MANIFEST_PATHNAME) >> $GITHUB_ENV | |
# If this worklow was triggered by a release event, upload the release manifest as a GitHub release asset. | |
- name: Upload release manifest | |
if: (github.event_name == 'release' && startsWith(matrix.os, 'ubuntu')) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ env.MANIFEST_PATHNAME }} | |
asset_name: ${{ env.MANIFEST_NAME }} | |
asset_content_type: application/toml |