|
1 | | -# Build binaries for macOS and Linux, publish Node.js packages, create release |
2 | 1 | name: build-publish-release |
3 | 2 |
|
4 | 3 | on: |
5 | 4 | push: |
6 | | - branches: |
7 | | - - main |
| 5 | + tags: |
| 6 | + - 'v*.*.*' |
8 | 7 |
|
9 | 8 | jobs: |
10 | 9 | publish-node-packages: |
|
46 | 45 | env: |
47 | 46 | NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
48 | 47 |
|
| 48 | + create-release: |
| 49 | + needs: [publish-node-packages] |
| 50 | + |
| 51 | + runs-on: ubuntu-latest |
| 52 | + |
| 53 | + steps: |
| 54 | + - name: Checkout |
| 55 | + uses: actions/checkout@v2 |
| 56 | + |
| 57 | + - name: Set version |
| 58 | + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV |
| 59 | + |
| 60 | + - name: Set current date |
| 61 | + run: | |
| 62 | + echo "RELEASE_DATE=$(date +"%d %B %Y")" >> $GITHUB_ENV |
| 63 | + |
| 64 | + - name: Get version from tag |
| 65 | + id: tag_name |
| 66 | + run: | |
| 67 | + echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v} |
| 68 | +
|
| 69 | + - name: Get Changelog Entry |
| 70 | + id: changelog_reader |
| 71 | + uses: mindsers/changelog-reader-action@v2 |
| 72 | + with: |
| 73 | + validation_level: none |
| 74 | + version: ${{ steps.tag_name.outputs.current_version }} |
| 75 | + path: ./CHANGELOG.md |
| 76 | + |
| 77 | + - name: Compute checksums |
| 78 | + run: | |
| 79 | + echo "## ${{ env.RELEASE_VERSION }} (${{ env.RELEASE_DATE }})" >> checksums.md |
| 80 | + echo "${{ steps.changelog_reader.outputs.changes }}" >> checksums.md |
| 81 | + echo "" >> checksums.md |
| 82 | + echo "" >> checksums.md |
| 83 | +
|
| 84 | + - name: Release |
| 85 | + uses: softprops/action-gh-release@v1 |
| 86 | + with: |
| 87 | + prerelease: false |
| 88 | + body_path: checksums.md |
| 89 | + files: | |
| 90 | + LICENSE |
| 91 | + env: |
| 92 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + |
| 94 | + notify-community: |
| 95 | + needs: [create-release] |
| 96 | + runs-on: ubuntu-latest |
| 97 | + steps: |
| 98 | + - name: Checkout |
| 99 | + uses: actions/checkout@v2 |
| 100 | + - name: Get version from tag |
| 101 | + id: tag_name |
| 102 | + run: | |
| 103 | + echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v} |
| 104 | + - name: Post to the community Slack channel |
| 105 | + |
| 106 | + with: |
| 107 | + channel-id: 'C04KT9JNRHS' |
| 108 | + payload: | |
| 109 | + { |
| 110 | + "text": "[Release] Baselime Lambda Opentelemetry for Node.JS v${{ steps.tag_name.outputs.current_version }}", |
| 111 | + "blocks": [ |
| 112 | + { |
| 113 | + "type": "section", |
| 114 | + "text": { |
| 115 | + "type": "mrkdwn", |
| 116 | + "text": "*[Release] Baselime Lambda Opentelemetry for Node.JS v${{ steps.tag_name.outputs.current_version }}*" |
| 117 | + } |
| 118 | + }, |
| 119 | + { |
| 120 | + "type": "section", |
| 121 | + "text": { |
| 122 | + "type": "mrkdwn", |
| 123 | + "text": "<https://github.com/Baselime/lambda-node-opentelemetry/releases/tag/v${{ steps.tag_name.outputs.current_version }}|https://github.com/Baselime/lambda-node-opentelemetry/releases/tag/v${{ steps.tag_name.outputs.current_version }}>" |
| 124 | + } |
| 125 | + } |
| 126 | + ] |
| 127 | + } |
| 128 | + env: |
| 129 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
| 130 | + |
0 commit comments