fix(deps): update golang docker tag to v1.22.2 #15
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: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
create_release: | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
version: ${{ steps.version.outputs.package_version }} | |
steps: | |
- name: filter version variable | |
id: version | |
run: | | |
export VERSION="$(echo ${{github.ref_name}} | sed 's/^v//')" | |
echo "::set-output name=package_version::$VERSION" | |
- name: create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.version.outputs.package_version }} | |
release_name: Release ${{ steps.version.outputs.package_version }} | |
draft: false | |
prerelease: false | |
go_build: | |
runs-on: ubuntu-latest | |
container: | |
image: registry.fsrv.services/fsrvcorp/container/debian-build:latest | |
needs: [create_release] | |
env: | |
CGO_ENABLED: 0 | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
strategy: | |
matrix: | |
goos: [linux, freebsd] | |
goarch: [amd64, arm64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build | |
run: go build -o openzfs_exporter -ldflags="-s -w -X github.com/fsrv-xyz/version.Version=${VERSION} -X github.com/fsrv-xyz/version.BuildUser=$(whoami)@$(uname --nodename) -X github.com/fsrv-xyz/version.BuildDate=$(date +%d-%B-%Y)" -trimpath -buildvcs=false ./cmd/openzfs_exporter | |
- run: tar -czf openzfs_exporter_${{ needs.create_release.outputs.version }}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz openzfs_exporter LICENSE README.md | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./openzfs_exporter_${{ needs.create_release.outputs.version }}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz | |
asset_name: openzfs_exporter_${{ needs.create_release.outputs.version }}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz | |
asset_content_type: application/gzip | |
deb_packages: | |
container: | |
image: registry.fsrv.services/fsrvcorp/container/debian-build:latest | |
runs-on: ubuntu-latest | |
needs: [create_release] | |
env: | |
CGO_ENABLED: 0 | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
strategy: | |
matrix: | |
goos: [linux] | |
goarch: [amd64, arm64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- run: apt update && apt install -y binutils-aarch64-linux-gnu | |
- name: Build | |
run: go build -o openzfs-exporter -ldflags="-s -w -X github.com/fsrv-xyz/version.Version=${VERSION} -X github.com/fsrv-xyz/version.BuildUser=$(whoami)@$(uname --nodename) -X github.com/fsrv-xyz/version.BuildDate=$(date +%d-%B-%Y)" -trimpath -buildvcs=false ./cmd/openzfs_exporter | |
- name: replace template variables | |
run: | | |
export VERSION=${{ needs.create_release.outputs.version }} | |
sed -i "s/%VERSION%/$VERSION/g" debian/changelog | |
sed -i "s/%ARCHITECTURE%/$GOARCH/g" debian/control | |
- run: cp init/openzfs_exporter.service debian/openzfs-exporter.service | |
- run: mkdir package && mv debian package | |
- run: (cd package && dpkg-buildpackage -rfakeroot -b -uc -us --host-arch $GOARCH) | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./openzfs-exporter_${{ needs.create_release.outputs.version }}_${{ matrix.goarch }}.deb | |
asset_name: openzfs-exporter_${{ needs.create_release.outputs.version }}_${{ matrix.goarch }}.deb | |
asset_content_type: application/octet-stream |