Skip to content

Add GitHub Actions workflow for releasing the application (#5) #1

Add GitHub Actions workflow for releasing the application (#5)

Add GitHub Actions workflow for releasing the application (#5) #1

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22' # Specify the Go version
- name: Get dependencies
run: go mod tidy
- name: Build binary
run: |
GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o iot-ephemeral-value-store-server main.go
chmod +x iot-ephemeral-value-store-server
- name: Package files
run: tar czvf iot-ephemeral-value-store-server.tar.gz iot-ephemeral-value-store-server
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./iot-ephemeral-value-store-server.tar.gz
asset_name: iot-ephemeral-value-store-server.tar.gz
asset_content_type: application/gzip