dethrace/.github/workflows/workflow.yml

64 lines
2.0 KiB
YAML

name: Workflow
on:
push:
jobs:
build-linux:
if: always()
needs: create-release
runs-on: ubuntu-18.04
strategy:
matrix:
platform: [gcc]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Obtain tag version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build and test
env:
CC: ${{ steps.vars.outputs.cc }}
CXX: ${{ steps.vars.outputs.cxx }}
MATRIX_PLATFORM: ${{ matrix.platform }}
run: .github/scripts/build-linux.sh
- name: Create artifact
if: startsWith(github.ref, 'refs/tags/')
run: |
tar -czvf ${{ github.workspace }}/dethrace-${{ steps.get_version.VERSION }}-linux-amd64.tar.gz ./build/dethrace
- name: upload linux artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/dethrace-${{ steps.get_version.VERSION }}-linux-amd64.tar.gz
asset_name: dethrace-${{ steps.get_version.VERSION }}-linux-amd64.tar.gz
asset_content_type: application/octet-stream
create-release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Obtain tag version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: true
release_name: Dethrace ${{ steps.get_version.outputs.VERSION }}
tag_name: ${{ github.ref }}
body: "hello world"
env:
GITHUB_TOKEN: ${{ github.token }}