diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml new file mode 100644 index 0000000..f04d077 --- /dev/null +++ b/.github/workflows/c-cpp.yml @@ -0,0 +1,52 @@ +on: + push: + # Sequence of patterns matched against refs/tags + tags: + # Push events to matching v*, i.e. v1.0, v20.15.10 + - 'v*' +name: Create Release +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Install libncurses + run: sudo apt update && sudo apt install libncurses-dev make gcc + - name: make test + run: sudo make test + - name: make clean + run: sudo make clean + - name: make LDFLAGS=-static memstrack + run: make LDFLAGS=-static memstrack + # TODO: This assumes Github actions uses AMD64 + - name: Rename binary + run: mv memstrack memstrack-linux-amd64 + - name: Generate Release Note + run: sha1sum memstrack-linux-amd64 > release-note + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + # This token is provided by Actions, you do not need to create your own token + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + body_path: ./release-note + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. + # See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./memstrack-linux-amd64 + # TODO: This assumes Github actions uses AMD64 by default + asset_name: memstrack-linux-amd64 + asset_content_type: application/x-executable