Skip to content

Bump dependabot/fetch-metadata from 1 to 2 #38

Bump dependabot/fetch-metadata from 1 to 2

Bump dependabot/fetch-metadata from 1 to 2 #38

Workflow file for this run

name: CI
on:
push:
paths:
- 'source/**.go'
- 'go.mod'
- '.github/workflows/*.yml'
branches:
- '**'
tags:
- '*.*.*'
workflow_dispatch:
env:
PROJECT_NAME: kasa-smart-plug
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
operatingSystem: [ 'linux', 'windows' ]
architecture: [ 'amd64', '386', 'arm64', 'arm' ]
library: [ '', 'glibc', 'musl' ]
exclude:
- operatingSystem: windows
library: glibc
- operatingSystem: windows
library: musl
- operatingSystem: linux
library: ''
permissions:
contents: read
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Install build tools
if: ${{ matrix.library == 'musl' }}
run: sudo apt-get install --no-install-recommends --yes musl-tools
- name: Create artifact & executable name
id: names
env:
PROJECT_NAME: ${{ env.PROJECT_NAME }}
OPERATING_SYSTEM: ${{ matrix.operatingSystem }}
ARCHITECTURE: ${{ matrix.architecture }}
LIBRARY: ${{ matrix.library }}
uses: actions/github-script@v7
with:
script: |
const { PROJECT_NAME, OPERATING_SYSTEM, ARCHITECTURE, LIBRARY } = process.env;
const artifactName = [ PROJECT_NAME, OPERATING_SYSTEM, ARCHITECTURE, LIBRARY ]
.filter( value => value != '' )
.join( '-' );
const executableName = artifactName + ( OPERATING_SYSTEM == 'windows' ? '.exe' : '' );
core.setOutput( 'artifact', artifactName );
core.setOutput( 'executable', executableName );
- name: Build executable
env:
GOOS: ${{ matrix.operatingSystem }}
GOARCH: ${{ matrix.architecture }}
CC: ${{ matrix.library == 'musl' && '/usr/bin/musl-gcc' || '' }}
run: go build -v -ldflags='-s -w' -o ${{ steps.names.outputs.executable }} ./source/
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.names.outputs.artifact }}
path: ${{ steps.names.outputs.executable }}
release:
name: Release
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
permissions:
contents: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move executables
run: |
mv -v artifacts/${{ env.PROJECT_NAME }}-*/${{ env.PROJECT_NAME }}-* ./
rm -v -r artifacts
- name: Calculate checksums
run: |
md5sum ${{ env.PROJECT_NAME }}-* > MD5SUMS.txt
sha1sum ${{ env.PROJECT_NAME }}-* > SHA1SUMS.txt
sha256sum ${{ env.PROJECT_NAME }}-* > SHA256SUMS.txt
sha512sum ${{ env.PROJECT_NAME }}-* > SHA512SUMS.txt
- name: Create draft release
uses: softprops/action-gh-release@v2
with:
draft: true
tag_name: ${{ github.ref_name }}
files: |
${{ env.PROJECT_NAME }}-*
*SUMS.txt
token: ${{ secrets.GITHUB_TOKEN }}