update to go 1.22 & update dependencies #27
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: Go | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^1.22 | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Build linux amd64 | |
run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -mod=vendor -v -o somfy-rts-gateway | |
- name: Test | |
run: go test -mod=vendor -v ./... | |
- name: Build linux arm | |
run: GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=0 go build -mod=vendor -v -o ./arm/somfy-rts-gateway | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: gobin | |
path: | | |
somfy-rts-gateway | |
./arm/somfy-rts-gateway | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: gobin | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: kahoona/somfy-rts-gateway:latest | |
release: | |
name: Release somfy-rts-gateway | |
if: github.event_name == 'push' && contains(github.ref, '/tags/v') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: gobin | |
- name: zip linux amd64 | |
run: | | |
zip somfy-rts-gateway-linux-amd64.zip web/tmpl/* web/static/* README.md start.sh somfy.service somfy-rts-gateway | |
- name: zip linux arm | |
run: | | |
zip somfy-rts-gateway-linux-arm.zip web/tmpl/* web/static/* README.md start.sh somfy.service ./arm/somfy-rts-gateway | |
- 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 }} | |
body_path: ./README.md | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: 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: ./somfy-rts-gateway-linux-amd64.zip | |
asset_name: somfy-rts-gateway-linux-amd64.zip | |
asset_content_type: application/zip | |
- name: Upload Release Asset Arm | |
id: upload-release-asset-arm | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./somfy-rts-gateway-linux-arm.zip | |
asset_name: somfy-rts-gateway-linux-arm.zip | |
asset_content_type: application/zip | |