diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 4964dd3..73ffc56 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -1,5 +1,6 @@ name: C/C++ CI +#on: [push, pull_request] on: push: pull_request: @@ -26,15 +27,18 @@ jobs: - name: Get current date id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d_%H-%M-%S')" + run: echo "::set-output name=date::$(env TZ=Asia/Taipei date +'%Y-%m-%d_%H-%M-%S')" - name: Get respository name id: repository_name run: echo "::set-output name=repository_name::$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" + - name: Get current branch + id: branch + run: echo "::set-output name=branch::$(echo '${{ github.ref }}' | awk -F '/' '{print $NF}')" - name: Upload build output uses: actions/upload-artifact@v2 with: - name: ${{ steps.repository_name.outputs.repository_name }} + name: ${{ steps.repository_name.outputs.repository_name }}-${{ steps.branch.outputs.branch }} path: a.out - name: Create Release @@ -43,8 +47,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ steps.date.outputs.date }} - release_name: ${{ steps.date.outputs.date }} + tag_name: ${{ steps.branch.outputs.branch }}-${{ steps.date.outputs.date }} + release_name: ${{ steps.branch.outputs.branch }}-${{ steps.date.outputs.date }} draft: false prerelease: false @@ -56,7 +60,7 @@ jobs: with: upload_url: ${{ steps.create_release.outputs.upload_url }} # 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 asset_path: ${{ github.workspace }}/a.out - asset_name: ${{ steps.repository_name.outputs.repository_name }} + asset_name: ${{ steps.repository_name.outputs.repository_name }}-${{ steps.branch.outputs.branch }} asset_content_type: application/octet-stream - name: Send mail @@ -74,6 +78,7 @@ jobs: # email body as text html_body:
branch | ${{ steps.branch.outputs.branch }} |
build commit message | ${{ github.event.head_commit.message }} |
build commit | https://github.com/${{ github.repository }}/commit/${{ github.sha }} |
build url | https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |