|
1 | 1 | name: Release
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - tags: |
6 |
| - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 4 | + release: |
| 5 | + types: [published] |
7 | 6 |
|
8 | 7 | jobs:
|
9 | 8 | release:
|
10 |
| - # There is no way to run a workflow on push tags on a specific branch. |
11 |
| - # The job should be skipped when running for a non-master branch. |
12 |
| - if: github.ref == 'refs/heads/master' |
13 |
| - name: Release (skip on non-main branch) |
| 9 | + name: Release |
14 | 10 | runs-on: ubuntu-latest
|
15 | 11 | steps:
|
16 | 12 | - name: Branch name
|
17 | 13 | id: branch_name
|
18 | 14 | run: |
|
| 15 | + echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} |
19 | 16 | echo ::set-output name=TARBALL::grammarly-focal-${GITHUB_REF#refs/tags/}.tgz
|
20 | 17 | - name: Checkout code
|
21 | 18 | uses: actions/checkout@v2
|
22 | 19 | - run: yarn install
|
23 | 20 | - run: yarn build
|
24 | 21 | - run: yarn test
|
25 | 22 | - run: yarn package
|
26 |
| - - name: Create Release |
27 |
| - id: create_release |
28 |
| - uses: actions/create-release@v1 |
29 |
| - env: |
30 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
31 |
| - with: |
32 |
| - tag_name: ${{ github.ref }} |
33 |
| - release_name: ${{ github.ref }} |
34 |
| - draft: false |
35 |
| - prerelease: false |
36 |
| - - name: Upload Release Asset |
37 |
| - id: upload-release-asset |
38 |
| - uses: actions/upload-release-asset@v1 |
39 |
| - env: |
40 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 23 | + - name: Upload binaries to release |
| 24 | + uses: svenstaro/upload-release-action@v2 |
41 | 25 | with:
|
42 |
| - 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 |
43 |
| - asset_path: ./packages/focal/${{ steps.branch_name.outputs.TARBALL }} |
| 26 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + file: ./packages/focal/${{ steps.branch_name.outputs.TARBALL }} |
44 | 28 | asset_name: ${{ steps.branch_name.outputs.TARBALL }}
|
45 |
| - asset_content_type: application/zip |
| 29 | + tag: ${{ github.ref }} |
0 commit comments