-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added github action for release automation
- Loading branch information
1 parent
b26fe0e
commit 122309b
Showing
2 changed files
with
58 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
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,57 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build-release: | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') | ||
|
||
name: Build release | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get version | ||
id: getVersion | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
|
||
- name: Prepare release | ||
env: | ||
REPOSITORY: ${{ github.event.repository.name }} | ||
VERSION: ${{ steps.getVersion.outputs.VERSION }} | ||
run: mkdir release && git archive --prefix ${REPOSITORY}/ ${VERSION} --format=zip > release/${REPOSITORY}-${VERSION}.zip | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: latest | ||
path: release | ||
release: | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') | ||
name: Publish release | ||
needs: [build-release] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download release artifacts | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: latest | ||
|
||
- name: Upload assets | ||
uses: svenstaro/upload-release-action@v1-release | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: latest/* | ||
asset_name: | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
file_glob: true |