Skip to content

Fix release pipeline #2

Fix release pipeline

Fix release pipeline #2

Workflow file for this run

name: Build and Release Binaries
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build and Publish Binaries
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin]
goarch: [amd64, arm64]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.23 # Set the Go version
- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
mkdir -p dist
go build -o dist/borgbackuptransactions_exporter-${{ matrix.goos }}-${{ matrix.goarch }}
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: borgbackuptransactions_exporter-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/borgbackuptransactions_exporter-${{ matrix.goos }}-${{ matrix.goarch }}
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
path: ./dist
- name: Create Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist
asset_name: borgbackuptransactions_exporter-${{ matrix.goos }}-${{ matrix.goarch }}
asset_content_type: application/octet-stream