Skip to content

Commit

Permalink
Add a Github action for creating static release
Browse files Browse the repository at this point in the history
Signed-off-by: Kairui Song <kasong@redhat.com>
  • Loading branch information
ryncsn committed Aug 1, 2020
1 parent 6e8b0c5 commit ba919fa
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ba919fa

Please sign in to comment.