|
| 1 | +name: Create Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Create Release |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + # `github.ref` is in the form /refs/tags/vx.x.x so we need to extract the tagname |
| 14 | + # to correctly fill asset_name (which will be the actual name for downloaded files) |
| 15 | + - name: Set variables |
| 16 | + id: vars |
| 17 | + run: | |
| 18 | + echo "::set-output name=product::NoteReply-${GITHUB_REF/refs\/tags\/v/}" |
| 19 | +
|
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v2 |
| 22 | + |
| 23 | + - name: Build packages |
| 24 | + id: build_packages |
| 25 | + # before creating the archives, make sure to exclude the files we don't want. |
| 26 | + # however, leave .gitattributes uncommitted -- we want these files present in |
| 27 | + # the "source" packages generated by github when we create a tag |
| 28 | + run: | |
| 29 | + echo ".github export-ignore" >> .gitattributes |
| 30 | + git archive --worktree-attributes --format tar.gz --prefix ${{ steps.vars.outputs.product }}/ -o ./NoteReply.tar.gz ${{ github.ref }} |
| 31 | + git archive --worktree-attributes --format zip --prefix ${{ steps.vars.outputs.product }}/ -o ./NoteReply.zip ${{ github.ref }} |
| 32 | +
|
| 33 | + - name: Create Release |
| 34 | + id: create_release |
| 35 | + uses: actions/create-release@v1 |
| 36 | + env: |
| 37 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + with: |
| 39 | + tag_name: ${{ github.ref }} |
| 40 | + release_name: Release ${{ github.ref }} |
| 41 | + draft: false |
| 42 | + prerelease: false |
| 43 | + |
| 44 | + - name: Upload Release Tarball |
| 45 | + id: upload-release-tarball |
| 46 | + uses: actions/upload-release-asset@v1 |
| 47 | + env: |
| 48 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + with: |
| 50 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 51 | + asset_path: ./NoteReply.tar.gz |
| 52 | + asset_name: ${{ steps.vars.outputs.product }}.tar.gz |
| 53 | + asset_content_type: application/gzip |
| 54 | + |
| 55 | + - name: Upload Release Zip |
| 56 | + id: upload-release-zip |
| 57 | + uses: actions/upload-release-asset@v1 |
| 58 | + env: |
| 59 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + with: |
| 61 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 62 | + asset_path: ./NoteReply.zip |
| 63 | + asset_name: ${{ steps.vars.outputs.product }}.zip |
| 64 | + asset_content_type: application/zip |
0 commit comments