5 # Publish `v1.2.3` tags as releases.
15 os: [ubuntu-18.04, macos-11, windows-2019]
16 runs-on: ${{ matrix.os }}
19 uses: actions/setup-go@v2
21 go-version: ${{ matrix.go-version }}
24 uses: actions/checkout@v2
26 - uses: actions/cache@v2
29 # * Module download cache
30 # * Build cache (Linux)
32 # * Build cache (Windows)
36 ~/Library/Caches/go-build
37 %LocalAppData%\go-build
38 key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
41 # ==============================
42 # Linux/Macos/Windows Build
43 # ==============================
45 - name: Build Binary for ${{matrix.os}}
48 # ==============================
50 # ==============================
52 - name: Upload Linux Build
53 uses: actions/upload-artifact@v2
54 if: matrix.os == 'ubuntu-18.04'
57 path: ./cmd/bytomd/bytomd
59 - name: Upload MacOS Build
60 uses: actions/upload-artifact@v2
61 if: matrix.os == 'macos-11'
64 path: ./cmd/bytomd/bytomd
66 - name: Upload Windows Build
67 uses: actions/upload-artifact@v2
68 if: matrix.os == 'windows-2019'
71 path: ./cmd/bytomd/bytomd.exe
79 run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
82 uses: actions/checkout@v2
84 # ==============================
86 # ==============================
88 - name: Download Artifacts
89 uses: actions/download-artifact@v2
94 - name: Download Artifacts
95 uses: actions/download-artifact@v2
100 - name: Download Artifacts
101 uses: actions/download-artifact@v2
106 # ==============================
108 # ==============================
109 - name: Generate Change Log
112 chmod 755 ./.github/generate_change_log.sh
113 CHANGELOG=$(./.github/generate_change_log.sh ${{ env.RELEASE_VERSION}})
114 echo "CHANGELOG<<EOF" >> $GITHUB_ENV
115 echo "$CHANGELOG" >> $GITHUB_ENV
116 echo "EOF" >> $GITHUB_ENV
117 - name: Create Release
119 uses: actions/create-release@latest
121 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
123 tag_name: ${{ github.ref }}
124 release_name: ${{ github.ref }}
130 # Check downloaded files
133 - name: Upload Release Asset - Linux
134 uses: actions/upload-release-asset@v1
136 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138 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
139 asset_path: ./linux/bytomd
140 asset_name: bytomd_linux
141 asset_content_type: application/octet-stream
143 - name: Upload Release Asset - MacOS
144 uses: actions/upload-release-asset@v1
146 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148 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
149 asset_path: ./macos/bytomd
150 asset_name: bytomd_mac
151 asset_content_type: application/octet-stream
153 - name: Upload Release Asset - Windows
154 uses: actions/upload-release-asset@v1
156 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
158 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
159 asset_path: ./windows/bytomd.exe
160 asset_name: bytomd_windows.exe
161 asset_content_type: application/octet-stream