ci: add workflow to build and release binary on tag #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build the binary and create release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - '**' | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| cache-dependency-path: teamup-rocketchat-bot/go.sum | |
| - name: Build the binary for linux/amd64 | |
| working-directory: teamup-rocketchat-bot | |
| run: | | |
| GOARCH=amd64 GOOS=linux go build -o build/linux-amd64-${{ github.ref_name }} . | |
| echo "binary created with filename $(ls build/)" | |
| - name: Create GitHub release and upload binary | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: teamup-rocketchat-bot/build/linux-amd64-${{ github.ref_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |