Create Release #3
Workflow file for this run
This file contains 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: Create Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
create_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
body: | | |
## Installation Instructions | |
### Using the Binary | |
Download the binary for your platform from the releases page and add it to your PATH. | |
#### Example for Linux | |
```sh | |
wget https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/consul-uploader-linux-amd64 | |
chmod +x consul-uploader-linux-amd64 | |
sudo mv consul-uploader-linux-amd64 /usr/local/bin/consul-uploader | |
``` | |
#### Example for macOS | |
```sh | |
wget https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/consul-uploader-darwin-amd64 | |
chmod +x consul-uploader-darwin-amd64 | |
sudo mv consul-uploader-darwin-amd64 /usr/local/bin/consul-uploader | |
``` | |
#### Example for Windows | |
Download the binary from the releases page and add it to your PATH. | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
build: | |
needs: create_release | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
goos: linux | |
goarch: amd64 | |
extension: "" | |
- os: macos-latest | |
goos: darwin | |
goarch: amd64 | |
extension: "" | |
- os: windows-latest | |
goos: windows | |
goarch: amd64 | |
extension: ".exe" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.20' | |
- name: Build | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
run: go build -o consul-uploader-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.extension }} | |
- name: Upload Linux Binary | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./consul-uploader-linux-amd64 | |
asset_name: consul-uploader-linux-amd64 | |
asset_content_type: application/octet-stream | |
- name: Upload macOS Binary | |
if: matrix.os == 'macos-latest' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./consul-uploader-darwin-amd64 | |
asset_name: consul-uploader-darwin-amd64 | |
asset_content_type: application/octet-stream | |
- name: Upload Windows Binary | |
if: matrix.os == 'windows-latest' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./consul-uploader-windows-amd64.exe | |
asset_name: consul-uploader-windows-amd64.exe | |
asset_content_type: application/octet-stream |