-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Github action for creating static release
Signed-off-by: Kairui Song <kasong@redhat.com>
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
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 |